SMTP fails to recognize email address
Hi there,
i'm having a tough and irritating problem: when i create Transport from the Session in tomcat's (v 5.5) context, i get the following Exception:
SMTPAddressFailedException: 550 5.1.1 Bad destination mailbox address (myemail@provider.com)
i went google but with no success as well as nothing in java forums..
Interesting thing is that on my localhost it works fine, but when uploaded to remote server it fails (context.xml has the same settings). Here is my code:
-
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (Session) envCtx.lookup("mail/Session");
System.out.println(session.getProperty("mail.smtp.auth"));
Message message = new SMTPMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(to.trim()));
message.setSubject(subject);
message.setContent(text, "text/plain;charset=windows-1257");
Transport service = session.getTransport("smtp");
service.connect();
message.saveChanges();
service.sendMessage(message, message.getRecipients(Message.RecipientType.TO));
service.close();
-
.. and context.xml for application:
-
<?xml version="1.0" encoding="UTF-8"?>
<Context
reloadable="true"
workDir="......">
<Resource
name="mail/Session"
type="javax.mail.Session"
mail.smtp.host="mail.takas.lt" mail.debug="true"/>
</Context>
--
Any help, please? Would appreciate it alot.
Ramunas

