change sender address when sending mail through gmail in c#

This is the solution:

  1. use the codes above to set mail.From = new MailAddress(address, display name)
  2. in Gmail, go to Mail Settings >> Accounts and Import.
  3. Add the email account you will use as sender in “Send Mail As”. (tick as Alias)

This works for me

Leave a Comment