Swift mailing problem

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
norna
Forum Newbie
Posts: 1
Joined: Sat Jan 20, 2007 9:43 am

Swift mailing problem

Post 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";
?>
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 :)
Post Reply