Jump to content


This topic is now archived and is closed to further replies.


SwiftMailer gining 500 error ...

Recommended Posts

Hi,   <noob here>


The google group for swift mailer is blocked at my work, so i hope I can get some help here as this site is open.


  • I have a PHP site (working fine) on a windows server running PHP over IIS.
  • I have an ASP site working fine (actually 2 of them) on the same windows server using ASP.Net / VB omn IIS.
  • The ASP site can send emails by relaying them to a seperate exchange server.
  • The PHP site at the moment is failing to send emails.
  • As the ASP site can send emsils I know that
    • The userid and password being used is correct
    • The IP of the exchange server is correct
    • All required ports etc are open as it works on ASP

I installed SwiftMailer and have the following test page code ...


I tried attempt 1 first, but that didn't work. So i tried attempt 2 (all code from manual) but again the 500 error.


If I comment out the $mailer->send() lines the page renders normally, so it is failing on the send command. I suspect I have a config issue, can someone suggest what to look at please?



- GC


"500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed."



// Create the Transport
$transport = Swift_SmtpTransport::newInstance('xx.xx.xx.xx', 25)

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

// Or to use the Echo Logger
$logger = new Swift_Plugins_Loggers_EchoLogger();
$mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));

// Create a message
$message = Swift_Message::newInstance('Test Swift subject')
	->setFrom(array('from.user@our.com' => 'From me'))
	->setTo(array('to.user1@our.com' => 'To Them','to.user2@our.com' => 'Other User'))
	->setBody('Here is the message body itself')

//	Attempt 1	
//	Send the message
$result = $mailer->send($message);
echo "result=[$result]<br />";

//	Attempt 2
//	Pass a variable name to the send() method
if (!$mailer->send($message, $failures))
	echo "Failures:";

echo function_exists('proc_open') ? "Yep, that will work" : "Sorry, that won't work";


Share this post

Link to post
Share on other sites



Got some error messages displaying ... it is connecting to the microsoft exchange server but it is not authenticating.


Does the ANONYMOUS bit mean it is not using the username and password I tried to set it to?


++ Starting Swift_SmtpTransport
<< 220 xx.xx.xx.xx Microsoft ESMTP MAIL Service ready at Mon, 11 Mar 2013 12:32:06 +0300 
>> EHLO aa.bb.cc.dd 
<< 250-xx.xx.xx.xx Hello [aa.bb.cc.dd] 250-SIZE 10485760 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-X-ANONYMOUSTLS 250-AUTH NTLM LOGIN 250-X-EXPS NTLM 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 XEXCH50 
<< 334 VXNlcm5hbWU6 
>> aWNtc19zY2hlZHVsZXI= 
<< 334 UGFzc3dvcmQ6 
>> RnIwZ0JsdWU= 
<< 535 5.7.3 Authentication unsuccessful 
!! Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful "
>> RSET 
<< 250 2.0.0 Resetting 

Share this post

Link to post
Share on other sites

It was hashing the username and password in some format I don't know and therefore was not authenticating.


I removed these lines and it worked:

  1. ->setUsername('uuuuuuuuu')
  2. ->setPassword('ppppppppp')

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.