Symfony2 Swiftmailer Not Sending

前端 未结 7 827
南旧
南旧 2021-02-07 04:14

I am having trouble sending emails with symfony2 and swiftmailer. I am also a bit lost on how to debug this issue. Below is the code. First I am creating a form to display. On s

7条回答
  •  佛祖请我去吃肉
    2021-02-07 04:55

    config.yml

    # Swiftmailer Configuration
    swiftmailer:
        transport:  smtp
        encryption: ssl
        auth_mode:  login
        host:       smtp.xx.eu
        username:   username
        password:   password 
    

    controller/action

    $messageObject = \Swift_Message::newInstance()
                ->setSubject('Subject')
                ->setFrom('username@xx.eu')
                ->setTo('xxx@stackoverflow.eu')
                ->setBody('message');
    $this->get('mailer')->send($messageObject);
    

提交回复
热议问题