help !!!

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
vaccuchuoi
Forum Newbie
Posts: 2
Joined: Tue Jun 23, 2009 10:42 pm

help !!!

Post by vaccuchuoi »

hix hix i want to sent mail by SMTP but i can't.
first :used phpmailer =>error can't fix.
seconds used a lirary SMTP another forum =>error can't fix.
then

used Swift-4.0.3 => error again please help me.tell me .
this my code :

Code: Select all

require_once 'lib/swift_required.php';
 
//Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com',465)
  ->setUsername('vaccuchuoi@gmail.com')
  ->setPassword('1212851285');
 
$mailer = Swift_Mailer::newInstance($transport);
 
//Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
  ->setFrom(array('vaccuchuoi@gmail.com' => 'John Doe'))
  ->setTo(array('trunhan@caonguyenxanh.com.vn', 'trunhan@caonguyenxanh.com.vn' => 'A name'))
  ->setBody('Here is the message itself') ;
  
//Send the message
$result = $mailer->send($message);


and this error :
Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 220 but got code "", with message ""' in /home/bpcom123/public_html/mail/lib/classes/Swift/Transport/AbstractSmtpTransport.php:416 Stack trace: #0 /home/bpcom123/public_html/mail/lib/classes/Swift/Transport/AbstractSmtpTransport.php(309): Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array) #1 /home/bpcom123/public_html/mail/lib/classes/Swift/Transport/AbstractSmtpTransport.php(117): Swift_Transport_AbstractSmtpTransport->_readGreeting() #2 /home/bpcom123/public_html/mail/lib/classes/Swift/Mailer.php(84): Swift_Transport_AbstractSmtpTransport->start() #3 /home/bpcom123/public_html/mail/swicth.php(18): Swift_Mailer->send(Object(Swift_Message)) #4 {main} thrown in /home/bpcom123/public_html/mail/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 416
hix this the three day to test send mail by SMTP

please help me ! :cry:
Post Reply