Page 1 of 1

Swift mailing problem

Posted: Sat Jan 20, 2007 9:52 am
by norna
I am using Swift-2.1.17-php4 to send emails from within a php script. The emails are sent but i don't get the "well" (from the last script line) displayed, just a blank page. What am i doing wrong, can someone please help? Here is my code:

Code: Select all

<?php
$emailblock=array();
$prenume="Do";
$name="Lla";
$emailadresse="recipient1@gmail.com";
$emailblock[]=array($prenume.' '.$name, $emailadresse);
$prenume="Dod";
$name="Lla";
$emailadresse="recipient2@yahoo.com";
$emailblock[]=array($prenume.' '.$name, $emailadresse);
$subject="Bla";
$mailtext="well";

require('Swift/Swift.php');
require('Swift/Swift/Connection/SMTP.php');
$mailer = new Swift(new Swift_Connection_SMTP('smtp.gmail.com', 465, SWIFT_TLS)); 
$mailer->authenticate('sender@gmail.com', 'pass');
if (!$mailer->hasFailed()) 
{ 
$mailer->send( 
$emailblock, 
'"FIIB" <sender@gmail.com>', 
''.$subject.'', 
"".$mailtext."" 
); 
}
else 
echo "The mailer failed to send the mail. Errors: <pre>" 
.print_r($mailer->errors, 1) 
."</pre><br />Log: <pre>" 
.print_r($mailer->transactions, 1) 
."</pre>"; 
if ($mailer->isConnected()) 
{ 
$mailer->close(); 
} 
echo "well";
?>

Posted: Wed Jan 31, 2007 6:51 am
by Chris Corbyn
Turn error reporting on.

Code: Select all

<?php error_reporting(E_ALL); ?>
I bet PHP doesn't have support for TLS. PHP needs to have been compiled with the OpenSSL library and have TLS support for this to work. Not displaying errors, or not reporting them will not help :)