How to send mail from any mail id through java? i meant how can we set from : address in mail any that we want.
+1
A:
Use the standard Java Mail API and just call setEnvelopeFrom()
on the message.
Aaron Digulla
2010-05-18 12:27:13
Why not use the `setFrom()` method?
Jesper
2010-05-18 12:29:00
@Jesper, else the SMTP server and/or Spamfilters will jerk.
BalusC
2010-05-18 13:23:18
MimeMessage msg = new MimeMessage(session); msg.setText(text); msg.setSubject(subject); msg.setFrom(new InternetAddress("[email protected]")); it still shows the from as the authenticated user. ref: http://code.geekinterview.com/java/send-email-using-gmail-mail-server.html
org.life.java
2010-05-19 06:19:11
@abc: So? You used setFrom() instead of setEnvelopeFrom(). What did you expect?
Aaron Digulla
2010-05-19 15:44:02
i expect from mail address can be any thing i want to set/.
org.life.java
2010-05-21 07:01:04
Yes, it's just a string. That's why you can't trust "From" in an email and why it's so hard to fight spam.
Aaron Digulla
2010-05-21 08:28:04