Symfony2 uses Swiftmailer to send emails.
To use and configure Swiftmailer in Symfony2, you must use the same configuration as in documents, for example. using YAML:
swiftmailer: transport: smtp encryption: ssl auth_mode: login host: smtp.gmail.com username: your_username password: your_password
Swiftmailer is defined in Symfony2 as a service, and an instance of it can be obtained in the controller as follows:
$mailerinstance = $this->get('mailer');
Now suppose that Swiftmailer requires two different configurations, for example. one that uses email buffering (for example, for a scheduled newsletter), and another that immediately sends all new emails (for example, for a lost password). Thus, I assume that two separate Swiftmailer instances should be defined. How can I do this in symfony2?
source share