• Post Reply Bookmark Topic Watch Topic
  • New Topic

Javamail error  RSS feed

 
vinod shirke
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Below is the code for sending the e-mail, getting the errors as written below the program


import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;


public class SendApp {
public static void send(String smtpHost, int smtpPort,String from, String to,String subject, String content) throws AddressException, MessagingException {
// Create a mail session
System.out.println("SMTPHostname ====>"+smtpHost);
java.util.Properties props = new java.util.Properties();
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.port", ""+smtpPort);
Session session = Session.getDefaultInstance(props, null);

// Construct the message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setText(content);

// Send the message
Transport.send(msg);
}

public static void main(String[] args) throws Exception {
// Send a test message
send("mail.vsnl.co.in", 25,"portal.teamibm@vsnl.co.in","vinod.shirke@tcs.com","Test Mail", "How about at this mail?");
}
}


Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 454 5.7.3
Client does not have permission to submit mail to this server.

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
333)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at SendApp.send(SendApp.java:24)
at SendApp.main(SendApp.java:29)


Kindly provide some solution

Regards
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, do you have permission to access that server? You don't seem to set a username and password - without that, few email servers will accept connections.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Client does not have permission to submit mail to this server

There's your problem. Looks like you don't have permission to 454 5.7.3. Speak to your SMTP server's administrator.

(Damn - too slow!)
[ March 06, 2006: Message edited by: Paul Sturrock ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!