swiftmailer problem
Posted: Thu Aug 31, 2006 5:08 am
I've been trying to get swiftmailer working for a while. I went through the documentation for testing with auth smtp.
I get the can't connect error. I tried telnet entering "o", enter, smtpserveraddress 25.
This connected me to my smtp server, so i assume thats ok. Not sure why it's not connecting.
Code: Select all
require('swift/Swift.php');
require('swift/Swift/Connection/SMTP.php');
$mailer = new Swift(new Swift_Connection_SMTP('my smtp server', SWIFT_SECURE_PORT, SWIFT_TLS));
//If anything goes wrong you can see what happened in the logs
if ($mailer->isConnected()) //Optional
{
//You can call authenticate() anywhere before calling send()
if ($mailer->authenticate('username', 'password'))
{
//Sends a simple email
$mailer->send(
'"Joe Bloggs" <mail@iwanttosendto.com>',
'"Your name" <you@yourdomain.com>',
'Some Subject',
"Hello Joe it's only me!"
);
}
else echo "Didn't authenticate to server";
//Closes cleanly... works without this but it's not as polite.
$mailer->close();
}
else echo "The mailer failed to connect. Errors: <pre>".print_r($mailer->errors, 1)."</pre><br />
Log: <pre>".print_r($mailer->transactions, 1)."</pre>";
print_r($mailer->transactions);This connected me to my smtp server, so i assume thats ok. Not sure why it's not connecting.