Я получил ту же ошибку раньше, и я добавил параметр "ssl" в Swift_SmtpTransport :: newInstance ('smtp.gmail.com', 465, "ssl"), как сказал osos.
ЭТО РАБОТАЕТ !!спасибо ..: D
это мой код:
<?php
require_once 'swift/lib/swift_required.php';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl")
->setUsername('XXXXXXX@gmail.com')
->setPassword('XXXXXXX');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('THIS IS THE SUBJECT')
->setFrom(array('XXXXXXX@gmail.com' => 'YOUR NAME'))
->setTo(array('XXXXXXX@gmail.com' => 'YOU'))
->setBody('This is the text of the mail send by Swift using SMTP transport.');
//$attachment = Swift_Attachment::newInstance(file_get_contents('path/logo.png'), 'logo.png');
//$message->attach($attachment);
$numSent = $mailer->send($message);
printf("Sent %d messages\n", $numSent);
?>