swiftmailer send email using gmail with custom domain

前端 未结 2 1378
庸人自扰
庸人自扰 2021-02-10 17:40

In symfony2.3 I am using swiftmailer.

I have a Google Apps address like myname@abc.com and my normal gmail address myname@gmail.com

When using:

         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-10 18:06

    When you create the message in your controller or anywhere, it's there where you put the sender (setFrom method)

    // Create a message
    $message = Swift_Message::newInstance('Wonderful Subject')
      ->setFrom(array('john@doe.com' => 'John Doe'))
      ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
      ->setBody('Here is the message itself')
    ;
    

    In your configuration file the mailer_user is used only for connecting to the gmail's smtp server.

提交回复
热议问题