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!

Oddity with setFrom() and setFrom(InternetAddress)

EJPNov 9 2011 — edited Nov 13 2011
I have an odd behaviour. If I have mail.user set as a session property, I should be able to call setFrom() with no arguments and send mail.

However if I do that I have an odd behaviour: I can't send mail To: another user in the same domain as mail.user. At least that seems to be the distinguishing feature.

However if I call MimeMessage.setFrom(new InternetAddress(session.getProperties().get("mail.user"))), it works.

There are no SMTP errors or exceptions in either case, it's just that the To: doesn't get through. However cc:s to users in other domains do get through in either case.

This seems pretty odd, as I am only doing in longhand what I would have thought setFrom() (no args) does anyway.

This could be a peculiarity of the SMTP server, which is "smtpout.secureserver.net:3535", plaintext. I don't know anything about it technically.

I can provide some userids and authentications offline if that will help, and I can post some code here, but it is basically exactly the same as per the example here modulo how the from-address gets set, and providing a proper Authenticator.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2011
Added on Nov 9 2011
9 comments
756 views