PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Dec 13, 2018 7:13 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri May 15, 2009 4:48 pm 
Offline
Forum Newbie

Joined: Fri May 15, 2009 4:33 pm
Posts: 2
Hello.
I'm upload Swift Mailer library v4.0.3.

I wrote a simple code (take from the documentation ):

Syntax: [ Download ] [ Hide ]
 
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
$mailer = Swift_Mailer::newInstance($transport);
 
$message = Swift_Message::newInstance($param['subject'])
          ->setFrom(array($param['from']))
          ->setTo(array($param['to']))
          ->setBody($param['text']);
 
$mailer->send($message);
 



When try to send a mail to get an error:

Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 220 but got code "", with message ""' in /cms/Modules/Mail/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php:416 Stack trace: #0 /cms/Modules/Mail/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(309): Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array) #1 /cms/Modules/Mail/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(117): Swift_Transport_AbstractSmtpTransport->_readGreeting() #2 /sata1/cms/Modules/Mail/Swift/lib/classes/Swift/Transport/SendmailTransport.php(71): Swift_Transport_AbstractSmtpTransport->start() #3 /cms/Modules/Mail/Swift/lib/classes/Swift/Mailer.php(84): Swift_Transport_SendmailTransport->start() #4 /cms/M in /cms/Modules/Mail/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 416

I have not found a problem in my code, or people with the same problem.

Maybe someone here can help me?


Top
 Profile  
 
PostPosted: Wed May 20, 2009 4:06 pm 
Offline
Forum Newbie

Joined: Fri May 15, 2009 4:33 pm
Posts: 2
No ideas? :cry:


Top
 Profile  
 
PostPosted: Mon Sep 07, 2009 12:04 pm 
Offline
Forum Newbie

Joined: Mon Sep 07, 2009 11:53 am
Posts: 1
It doesn't work for the author, but i had the same problem and i got the same trace.

The problem was about the server configuration. I you want to test, here's an example using gmail:

Syntax: [ Download ] [ Hide ]
 
/*It's symfony config, if you don't use symfony put: require_once 'lib/swift_required.php'; */
/* My route file was lib/vendor/swift, put your own route in any case. */
require_once sfConfig::get('sf_lib_dir').'/vendor/swift/swift_init.php';
 
 
/* Of course write a valid gmail account, my problem was that gmail needs ssl option*/
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
  ->setUsername('gmailuser')
  ->setPassword('passwordgmailuser')
  ;
 
  $mailer = Swift_Mailer::newInstance($transport);
 
 
$message = Swift_Message::newInstance()
 
//Give the message a subject
  ->setSubject('Your subject')
 
  //Set the From address with an associative array
  ->setFrom(array('user@yourdomain.com' => 'Author))
 
  //Set the To addresses with an associative array
  ->setTo(array('
reciever@domain.com' => 'Reciever'))
 
  //Give it a body
  ->setBody('
Testing swift mail');
 
  $result = $mailer->send($message);
 
 


I hope it helps you


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group