0

I have a IMAP server host name : xyz.com. And my SMTP host name is : comcast.net.

Now when I send emails via Outlook it automatically shows my ID [sender ID] as : myusername@xyz.com and not myusername@comcast.net.

I would like to achieve the same using JavaMail API.

When I use JavaMail API, it shows the sender as myusername@comcast.net. I understand this is the way it works. IMAP for receiving emails and SMTP for sending emails.

However, I would like to develop the behavior similar to that of Outlook where it sets IMAPs server hostname, instead of the SMTP's server hostname, in the sender ID.

Thanks & Regards, Ravikiran Mane.

1 Answers1

1

I think you're talking about the difference between what you put in the From header of the message (using the setFrom method), and what user name you use when you login to your mail server to send the message (using the connect method). Normally they would be the same. Your mail server may or may not allow you to set a different address in the From header. Some mail servers will require you to verify that the alternate From address is actually your address before they will let you send a message with that in the From header.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40