Closed starrychloe closed 8 years ago
Are you able to send your message successfully using plain SwiftMailter without Yii being involved?
No, it doesn't seem to work.
<?php
// echo phpinfo();
require_once 'vendor/swiftmailer/swiftmailer/lib/swift_required.php';
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 587)
->setUsername('contact@bestsales.com')
->setPassword('xxx')
->setEncryption('tls');
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
// Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('john@doe.com' => 'John Doe'))
->setTo(array('contact@bestsales.com'))
->setBody('Here is the message itself');
// Send the message
$result = $mailer->send($message);
$ php web/test.php
PHP Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/answer/14257 n77sm442213qhb.13 - gsmtp
This is not Yii issue. You may open a ticket at swiftmailer project.
What steps will reproduce the problem?
http://stackoverflow.com/questions/37290204/cannot-send-email-from-yii-swiftmail-to-gmail-expected-response-code-250-but-go/37290443
What's expected?
Expect the email to send.
What do you get instead?