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

[1691 byte] By [Vienzoa] at [2007-10-2 7:31:46]
# 1
The remote server refuses to send a message to that address because it doesn't know who you are. That's my guess. Ask the administrator of the remote server for clarification.
DrClapa at 2007-7-16 21:11:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

i guess that is not a problem, because the deny comes from the smtp server for recipient address which is correct, eventhough the sender (From) email is incorrect and mail server accepts it. Here's some debug output, maybe it could help?

-

MAIL FROM:<fakeemail@provider.lt>

250 2.1.0 fakeemail@provider.lt....Sender OK

RCPT TO:<correctemail@provider.com>

550 5.1.1 Bad destination mailbox address (correctemail@provider.com).

DEBUG SMTP: Invalid Addresses

DEBUG SMTP:correctemail@provider.com

DEBUG SMTP: Sending failed because of invalid destination addresses

RSET

250 2.0.0 Resetting

javax.mail.SendFailedException: Invalid Addresses;

nested exception is:

class com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 Bad destination mailbox address

...

the code 550 is response from smtp host, not the remote pc..

Vienzoa at 2007-7-16 21:11:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
More specifically, ask the administrator about relaying and why an SMTP server might not allow unknown users to send messages outside its domain.
DrClapa at 2007-7-16 21:11:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
Thanks, that was the correct direction - the problem was that you are unable to send email using different smtp server that is given you from your isp provider.. i was unaware of that..
Vienzoa at 2007-7-16 21:11:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...