Symfony 3.1 swiftmailer email doesn't send -
i wanted send test email using symfony 3.1 , swiftmailer, doesn't work. reading other solutions, still doesn't work.
config.yml:
swiftmailer: transport: %mailer_transport% encryption: %mailer_encryption% auth_mode: %mailer_auth_mode% host: %mailer_host% username: %mailer_user% password: %mailer_password% spool: { type: memory }
parameters.yml
mailer_transport: smtp mailer_encryption: ssl mailer_auth_mode: login mailer_host: smtp.gmail.com mailer_user: user@gmail.com mailer_password: mypass
parameters.yml v.2 trying:
mailer_transport: gmail mailer_encryption: ssl mailer_auth_mode: login mailer_host: smtp.gmail.com mailer_user: user@gmail.com mailer_password: mypass
controller:
public function contactaction(request $request) { $name = $request->request->get('name'); $surname = $request->request->get('surname'); $email = $request->request->get('email'); $subject = $request->request->get('subject'); $message = $request->request->get('message'); $data = ""; if($request->request->get('contact_submit')){ $message = \swift_message::newinstance() ->setsubject($subject) ->setfrom($email) ->setto('myemail@gmail.com') ->setbody($message); $this->get('mailer')->send($message); $data = "thank you: $name"; } return $this->render('przedszkole/contact.html.twig', array('data' => $data)); }
so after click submit, view change , show me: thank $name, don't email :/
i change security lvl of gmail e-mail tell in other solutions, doesn't me :/
i uncomment swiftmailer: delivery_adress in config_dev.yml.
i grateful :/
how use (only) following yml config:
mailer_transport: gmail mailer_user: user@gmail.com mailer_password: mypass
i read there default settings don't need set gmail , maybe because setting, has effect. i'm not sure if fix problem, can try it.
Comments
Post a Comment