I have to send a mail to Right fax server through Java Mail API in this format /fax=12345/[email protected].
I used the following code to set recipient address
Message message = new MimeMessage(session);
InternetAddress mail_to = new InternetAddress("[email protected]","/fax=12345/");
message.addRecipient(Message.RecipientType.TO, mail_to);
problem is, at receiver mail box I am not able to see the personal encoded value i.e.,/fax=12345/
I am aware of RFC822 format check. Is there any way to display the fax number in To address in receiver end.
Currently at receiver end---------------- To:[email protected]
My Requirement at receiver end -----------To:/fax=12345/[email protected]
The "/fax=12345/" is not a personal name field, which is why it isn't working the way you did it.
Also, RFC822 requires that certain characters in email addresses have to be in quotes or they're illegal.
To be a legal address, you need something like "/fax=12345/mail_id"@domain.com. To get that with JavaMail, use
new InternetAddress("\"/fax=12345/mail_id\"@domain.com")
If the receiver end doesn't accept the quotes, you may have trouble convincing SMTP servers to accept the address without quotes, even if you set it as a raw header value as suggested in your other recent post.