Mails not sent

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
kkonline
Forum Contributor
Posts: 251
Joined: Thu Aug 16, 2007 12:54 am

Mails not sent

Post by kkonline »

Code: Select all

 
<?php
 
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
 
//Start Swift
$swift =& new Swift(new Swift_Connection_SMTP("smtp.your-host.tld"));
 
//Create the message
$message =& new Swift_Message("My subject", "My body");
 
//Now check if Swift actually sends it
if ($swift->send($message, "foo@bar.tld", "me@mydomain.com")) echo "Sent";
else echo "Failed";
 ?>
this is the mail i am using
however i receive the following errors and the mail is not delivered. Can someone suggest something


Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [server.tld:25]: fsockopen returned Error Number 100 and Error String ''' in /home/mysite/public_html/addons/swiftmailer/lib/Swift/Connection/SMTP.php:309 Stack trace: #0 /home/mysite/public_html/addons/swiftmailer/lib/Swift.php(216): Swift_Connection_SMTP->start() #1 /home/mysite/public_html/addons/swiftmailer/lib/Swift.php(101): Swift->connect() #2 /home/mysite/public_html/addons/swiftmailer/simple.php(6): Swift->__construct(Object(Swift_Connection_SMTP)) #3 {main} thrown in /home/mysite/public_html/addons/swiftmailer/lib/Swift/Connection/SMTP.php on line 309
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Mails not sent

Post by Chris Corbyn »

Are you connecting to the correct SMTP server? Is there maybe a firewall rule in place blocking the attempt?
Post Reply