JavaMail, Gmail-Auth, and setFrom APIs

for this application, I follow this example:

http://pipoltek.blogspot.com/2008/02/sending-mail-using-gmail-smtp-server.html

I can send emails, it looks good ..... but I want to change the sender's email using this:

MimeMessage msg = new MimeMessage(mailSession); msg.setFrom(new InternetAddress(" baba-jaga@gmail.com ")); 

baba-jaga@gmail.com - dummy E-Mail, not mine :)

When t use setFrom , I get an email from this email, which I use for authentication. Is authentication a reason that disables the setFrom method?

I need to change the "from" email, because I want the recipient to send me a replay to a different email address.

+6
java email gmail javamail sender
source share
1 answer

The Google SMTP server prevents the use of an address from another authenticated account. This is a security measure to prevent what is called "spoofing." Perhaps you can try setting the response to a different value and see if Google allows it.

+7
source share

All Articles