This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Sending mail with two Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Sending mail with two "@" in address" Watch "Sending mail with two "@" in address" New topic

Sending mail with two "@" in address

arun sharma

Joined: Jul 02, 2003
Posts: 19
Hi All;
I have to send mail to
address using java mail API to lotus notes server 5.0
But the java mail APi is throwing exception about invalid mail address.
How can i solve this problem...........
thanks a ton
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

You only have two address types defined in the JavaMail API: InternetAddress and NewsAddress. Normally you would send a message with an InternetAddress - which has loose SMTP address validation (I say loose, since it will allow addresses with no '@' symbol, so not 100% RFC 821 compliant). So creating an InternetAddress will parse your ABC@MAIL.COM@SECURE address and fail, because it is not a valid SMTP mail address. Lotus Notes is more than just an SMTP compliant server - hence a Notes address is different from an SMTP address. You can use Notes 5+ as just an SMTP server and it will work with the JavaMail api, but to do this you must use SMTP compliant mail addresses i.e. 'local-part "@" domain'. What you have to ask is if you need any more functionality from Notes than just sending email(authentication perhaps, since SMTP is insecure by design?). If you don't, then you will need to convert a Notes address into an SMTP address - then everything should work fine. If however you do, then you will need to write a Transport implementation and an Address implementation for Notes. And since no one has done this yet, I suspect it might be quite an awkward job.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
jQuery in Action, 2nd edition
subject: Sending mail with two "@" in address
Similar Threads
Read receipt
Java Mail
outlook express address book accessing
Java Beans and JSP