javax.mail.SendFailedException: Recipient unknown
843830Aug 22 2003 — edited Jul 25 2008Hi,
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();
}
}
}