PHPmailer gmail 'from' is gmail account

后端 未结 2 1153
孤城傲影
孤城傲影 2020-12-11 09:47

I\'m trying to send a mail with PHPmailer and gmail. But when I send a mail its from my gmail account instead of no-reply. How do I set no-reply as from?

Code I have

2条回答
  •  余生分开走
    2020-12-11 09:55

    There are two options I would recommend trying:

    1. Log in to the Google Apps mail account for myaccount@web.com, go to Settings, then Accounts, then Send mail as, and ensure that no-reply@web.com has been validated. I haven't tested this, but this should allow to send mail from no-reply@web.com, rather than from no-reply@web.com on behalf of myaccount@web.com.

    2. Actually create a user on Google Apps with the username no-reply@web.com, and send email through that account. If myaccount@web.com needs a copy, you could always BCC the address and setup a filter on no-reply@web.com to forward any failures to myaccount@web.com.

提交回复
热议问题