08/12/2014 - SYMFONY
We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.
If you want to use different settings for Swiftmailer when sending emails then you can use example below. It gets the data from database and uses them instead.
Assume that you already have default settings in parameters.yml file but you don't want to use them.
$host = // Coming from database
$port = // Coming from database
$user = // Coming from database
$pswd = // Coming from database
$transport = \Swift_SmtpTransport::newInstance($host, $port)
$this->mailer = \Swift_Mailer::newInstance($transport);
$order = // Database object
$message = \Swift_Message::newInstance()