Search code examples
phpsymfonymailer

How to change setFrom in symfony2 mailer from defoult to setted in form fields


After filing form and submit in recieving emails, field 'from' is always default setted from parameters.ymn instead of typed in form field $message = \Swift_Message::newInstance()->setFrom(array($Register->getEmail() => $Register->getName())) I use gmail.


Solution

  • you should rather use your own email service to send emails like this, gmail overrides all from settings

    How to set 'FROM' property using Swiftmailer with Gmail? Google App-Gmail Unable to set from. Gmail replacing from address when sending via swiftmailer SMTP transport (PHP)