Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding Mail Server Connect  RSS feed

 
abhijit sane
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i have problem in mailing application that it does not working
that giving Invalid Address Exception

String to,from,smtphost
String msgtext = "--msg--";

boolean debug = Boolean.valueOf(smtphost).booleanValue();

out.println("value of (smtphost).booleanValue()"+debug);

//if is it is returning false. is the server connected?

Properties props = new Properties();
props.put("mail.smtp.host", smtphost);
props.put("mail.debug", "true");
Session ssn = Session.getInstance(props);

// is there required some other authentication in terms of user

//because it is giving exception SMTPAddressFailedException


Please, Help me finding Solutions.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which line of the code you posted does the exception occur?

Parts of the code look odd, e.g. "Boolean.valueOf(smtphost)" - the SMTP host is a server name or IP address, not something you can turn into a boolean; what is the purpose of that?
 
abhijit sane
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session is created but exception occuring in follwing code
that "com.sun.mail.smtp.SMTPAddressFailedException: smtp is currently not permitted to relay
550-through this server. Perhaps you have not logged into the pop/imap server
550-in the last 30 minutes or do not have SMTP Authentication turned on in your
550 email client.
"

Message msg = new MimeMessage(ssn);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject.toString());
msg.setText(msgtext);
Transport.send(msg);
out.println("Your msg is sent without an exception");
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to supply a password in order to send emails. That's done by using an Authenticator.
 
abhijit sane
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Dittmersir,
Exception is resolves.thanks lot.
-Abhijit
[ January 07, 2008: Message edited by: abhijit sane ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!