File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
I agree. Here's the link:
subject: Sending mail with two "@" in address
It's not a secret anymore!