How can I explicitly set the SMTP FROM: attribute when sending a message?
mail.smtp.from property can be used to set the SMTP FROM: attribute. If this property if absent, the message’s From attribute is used. If multiple threads need to send mail simultaneously, and each needs to set the From attribute, each thread should use its own Session object with its own Properties object. The mail.smtp.from property can then be set on each Properties object for each Session (and thus each thread) independently. Alternatively, each thread can use the com.sun.mail.SMTPMessage class. The setEnvelopeFrom method on that class can be used to set this value. With this approach, all threads can use the same Session.