Target Machine actively refusing
Posted: Mon May 05, 2008 12:58 pm
Hey gang,
I have a script that I want to use SwiftMailer for sending out confirmation emails on various database events that happen.
For simplicity sake, I made a function called useSwiftMailer() that accepts various parameters and invokes the SwiftMailer class to send an email.
The function seems to be working fine, and the emails are apparently being sent, however this page when accessed is causing many errors:
An error occurred in script '/home/user10/public_html/swiftlib/Swift/Connection/SMTP.php' on line 301:
fsockopen() [function.fsockopen]: unable to connect to mail.mydomain.com:25 (No connection could be made because the target machine actively refused it. )
Date/Time: 5-5-2008 13:42:38
Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [mail.mydomain.com:25]: fsockopen returned Error Number 10061 and Error String 'No connection could be made because the target machine actively refused it. '' in /home/user10/public_html/swiftlib/Swift/Connection/SMTP.php:309 Stack trace: #0 /home/user10/public_html/swiftlib/Swift.php(216): Swift_Connection_SMTP->start() #1 /home/user10/public_html/swiftlib/Swift.php(101): Swift->connect() #2 /home/user10/public_html/event-handling/process-event.php(74): Swift->__construct(Object(Swift_Connection_SMTP)) #3 /home/user10/public_html/event-handling/process-event.php(355): useSwiftMailer('Database Event H...', 'An event has taken pl...', 'event@mydomai...', false, 1) #4 {main} thrown in /home/user10/public_html/swiftlib/Swift/Connection/SMTP.php on line 309
---------
I have replaced the actual domain name with mydomain.com for privacy sake. I use SwiftMailer on many other scripts on my website without any issues. I have a feeling these errors are being caused because this function I created is being called numerous times during this particular script's execution.
I don't think I have any firewalls that are blocking ports like 25, etc... so I'm not sure where these errors are coming from. But with my php skills... it's probably something I did wrong.
Any help would greatly be appreciated. Thanks!
I have a script that I want to use SwiftMailer for sending out confirmation emails on various database events that happen.
For simplicity sake, I made a function called useSwiftMailer() that accepts various parameters and invokes the SwiftMailer class to send an email.
Code: Select all
function useSwiftMailer ($subject, $txtBody, $recipient, $mailingOn)
{
$fullTxtBody = outputThis($txtBody);
$smtp = new Swift_Connection_SMTP("mail.mydomain.com");
$smtp->setUsername("event+mydomain.com");
$smtp->setPassword("corbyncakes");
$swift = new Swift($smtp);
// Create a message
$message = new Swift_Message($subject, $fullTxtBody);
if ($mailingOn)
{
// Send Email:
if ($swift->send($message, new Swift_Address($recipient, "Seodevhead"), new Swift_Address("event@mydomain.com", "Database Event Happened")))
{
// Do nothing. Email sent successfully.
} else
{
// SwiftMailer failed. No email sent.
}
}
}An error occurred in script '/home/user10/public_html/swiftlib/Swift/Connection/SMTP.php' on line 301:
fsockopen() [function.fsockopen]: unable to connect to mail.mydomain.com:25 (No connection could be made because the target machine actively refused it. )
Date/Time: 5-5-2008 13:42:38
Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [mail.mydomain.com:25]: fsockopen returned Error Number 10061 and Error String 'No connection could be made because the target machine actively refused it. '' in /home/user10/public_html/swiftlib/Swift/Connection/SMTP.php:309 Stack trace: #0 /home/user10/public_html/swiftlib/Swift.php(216): Swift_Connection_SMTP->start() #1 /home/user10/public_html/swiftlib/Swift.php(101): Swift->connect() #2 /home/user10/public_html/event-handling/process-event.php(74): Swift->__construct(Object(Swift_Connection_SMTP)) #3 /home/user10/public_html/event-handling/process-event.php(355): useSwiftMailer('Database Event H...', 'An event has taken pl...', 'event@mydomai...', false, 1) #4 {main} thrown in /home/user10/public_html/swiftlib/Swift/Connection/SMTP.php on line 309
---------
I have replaced the actual domain name with mydomain.com for privacy sake. I use SwiftMailer on many other scripts on my website without any issues. I have a feeling these errors are being caused because this function I created is being called numerous times during this particular script's execution.
I don't think I have any firewalls that are blocking ports like 25, etc... so I'm not sure where these errors are coming from. But with my php skills... it's probably something I did wrong.
Any help would greatly be appreciated. Thanks!