When using Gmail for SMTP, can you set a different "from" address?

12,104

gmail doesn't allow you to use random From addresses. You have to add and validate the address you'd like to use in the gmail settings:

Settings -> Accounts -> Send mail as -> Add another email address you own
Share:
12,104
Kirk Beard
Author by

Kirk Beard

Updated on June 05, 2022

Comments

  • Kirk Beard
    Kirk Beard almost 2 years

    I am using Swift Mailer 406 for sending emails. I connect to my smtp.gmail.com account and then I do:

    ->setFrom(array($from => $fromname))
    

    But the emails sent got the original gmail account email.

    Can I change it?

  • dynamic
    dynamic about 13 years
    thanks. do you know if i can send many emails thru gmail without problems? (they are all legit sent to registered users from my website)
  • David Medenjak
    David Medenjak about 8 years
    Please also add an explanation to your answer, since code dumps are often hard to understand