1

I want to send email from my application by adding "on behalf of" address. Currently I am using apache common Email to send email and it seems I couldn't specify sender in there. As I can see email headers I need to set different values for sender and from to show email receive as "on behalf of" in the mail client.

Can anyone please help me to do this using java email client or can I achieve this using same apache common client? Solution needs to be work with most of common email clients like outlook, gmail etc..

2
  • Thanks for your reply. I can set only one email address as From. In my scenario I need to set from as two addresses. Like "Test <[email protected]> on behalf of John <[email protected]>". In From we can't set more than one email. So I need to set it in sender and from
    – JagKum
    Jun 7, 2017 at 2:44
  • Thanks @ScaryWombat it worked.
    – JagKum
    Jun 7, 2017 at 2:57

1 Answer 1

2

As per link

you can do

 msg.addHeader("Sender", "My Friend <[email protected]>");
1
  • 1
    Setting up different "From" and "Sender" header cause to add "On Behalf of" correctly in outlook email client. But I have noticed this way is not showing properly in Gmail or yahoo client( it still showing just from address). Does anyone know what is the reason.
    – JagKum
    Jul 6, 2017 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.