Possible causes for swiftmailer not working?

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
User avatar
jolinar
Forum Commoner
Posts: 61
Joined: Tue May 24, 2005 4:24 pm
Location: in front of computer

Possible causes for swiftmailer not working?

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The nonworking one may be in a blacklist, or may have a dynamic IP which is routinely blacklisted.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Any errors? Can you fsockopen() to the SMTP server on port 25 from both machines?
Post Reply