Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javax.mail.SendFailedException: Recipient unknown

843830Aug 22 2003 — edited Jul 25 2008
Hi,

I know similar topics have been posted before but even after going through them all I have still not found a solution.

I am trying to send alert emails through my JavaMail application and get the Exception below. I am able to send emails to internal address', but not external address' such as my hotmail account. I have even asked the Administrator to put my IP address in the list of allowed IP's. Does anyone have any ideas? If anyone would like to take a look at the source code i have pasted it underneath the stacktrace.

Thanks in advance.




javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 550 <nirbhay@hotmail.com>, Recipient unknown

javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 550 <nirbhay@hotmail.com>, Recipient unknown

at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at Test1.main(Test1.java:28)


SOURCE:

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

final public class Test1 {
private static Session session;

public static void main(String[] args)
{
try
{
Properties props = new Properties();

props.put ("mail.smtp.host", "207.132.45.5");
props.put ("mail.smtp.port", "25");
session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom (new InternetAddress ("from_user@domain.com"));
message.setRecipient (Message.RecipientType.TO, new InternetAddress ("nirbhay@hotmail.com"));
message.setSubject ("test message");
Multipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
multipart.addBodyPart (messageBodyPart);
messageBodyPart.setText ("message body");
message.setContent (multipart);
javax.mail.Transport.send (message);

} catch (Exception e) {
System.out.println (e.toString());
e.printStackTrace();
}
}
}

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2008
Added on Aug 22 2003
10 comments
3,132 views