T
T
Think With Your Head2016-09-04 04:17:26
symfony
Think With Your Head, 2016-09-04 04:17:26

Why doesn't SwiftMailer Symfony2 work on hosting?

Hello.
I'm trying to set up sending a letter in symfony 2.8 via gmail.
The connection parameters are set like right
config.yml

swiftmailer:
    transport: gmail
    username:  "%mailer_user%"
    password:  "%mailer_password%"

parameters.yml contains login and password respectively. in the docks of the symphony it is said that there is no need to prescribe anything else, all other parameters are pulled up automatically
when you enter the action controller that sends mail, nothing happens (letters do not come, there is also silence in the gmail account, I checked the spam folders)
/**
     * @Route("/email", name="email")
     */
    public function emailAction()
    {

        $message = \Swift_Message::newInstance()
           ->setSubject('Contact enquiry')
           ->setFrom('[email protected]')
           ->setTo('[email protected]')
           ->setBody(
               $this->renderView('TestBundle:Email:registration.html.twig', array('user' => 'user', 'pass'=>'test')),
               'text/html'
           );
       //print_r($message);
        $this->get('mailer')->send($message);

        $em = $this->getDoctrine()->getManager();
        $users = $em->getRepository('TestBundle:User')->findAll();

        return $this->render('TestBundle:Default:admin.html.twig', array(
            'users'=>$users
        ));
    }

at the same time, the standard mail () function passes with a bang in a second
on localhost, the letter in the symphony panel is displayed when I use SwiftMailer
, what's the trouble?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Romanenko, 2016-09-05
@slimus

check spool , maybe you have letters in the queue?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question