чтобы скрипт работал по SMTP с GMAIL
в скрипте ставим так
// Set SMTP connection details
$transport = Swift_SmtpTransport::newInstance()
->setHost('smtp.gmail.com') // Host. This should not need to change
->setPort(465) // Port. Do not change as SwiftMail does not support starttls
->setUsername('usermail@gmail.com')
->setPassword('12345'')
->setEncryption('ssl') // set the encription type.
;
потом идем на https://www.google.com/settings/u/2/security/lesssecureapps
и ставим

в скрипте ставим так
// Set SMTP connection details
$transport = Swift_SmtpTransport::newInstance()
->setHost('smtp.gmail.com') // Host. This should not need to change
->setPort(465) // Port. Do not change as SwiftMail does not support starttls
->setUsername('usermail@gmail.com')
->setPassword('12345'')
->setEncryption('ssl') // set the encription type.
;
потом идем на https://www.google.com/settings/u/2/security/lesssecureapps
и ставим
