Page 1 of 1

Possible causes for swiftmailer not working?

Posted: Tue Oct 17, 2006 6:13 pm
by jolinar
Here's the E-Mail propblem I'm having. Swiftmailer doesn't send messages on the web host I'm using (it doesn't report any errors, though) although the exact same code works fine on a machine I'm using for development (Fedora core 5, running with dynamic DNS)

Here's the code in question (well the appropriate sections)

Code: Select all

<?php

require('Swift-2.1.16/Swift.php');
require('Swift-2.1.16/Swift/Connection/Sendmail.php');
require('Swift-2.1.16/Swift/Connection/SMTP.php');

$connection = new Swift_Connection_Sendmail(SWIFT_AUTO_DETECT);
//$connection = new Swift_Connection_SMTP('mail.danielsnowden.co.uk');

$mailer = new Swift($connection);

?>
And the main section:

Code: Select all

$subject = "User Password For $user_name_reset";
				$message = "This is an automated message.  If you did not intend to recieve it, please ignore it.\n\nYou requested your password to be reset and/or confirmation of your username.\n\nUsername: $user_name_reset\nPassword: $pass\n\nRegards, Dan";
				
				if ($mailer->isConnected())
				{
					//Sends a simple email
					$mailer->send(
						$email_reset,
						"$admin_email@$server_addr",
						$subject,
						$message
					);
				}
				else {
					print "<p>Warning, message delivery failure!</p>\n";
				}
Does anyone know why this might work on one machine but not another?

Posted: Tue Oct 17, 2006 6:15 pm
by feyd
The nonworking one may be in a blacklist, or may have a dynamic IP which is routinely blacklisted.

Posted: Tue Oct 17, 2006 6:39 pm
by Chris Corbyn
Any errors? Can you fsockopen() to the SMTP server on port 25 from both machines?