Jump to content

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?

 

Thanks

- GC

 

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

 

<?PHP
require_once("../Swift-4.3.0/lib/swift_required.php");

// Create the Transport
$transport = Swift_SmtpTransport::newInstance('xx.xx.xx.xx', 25)
	->setUsername('uuuuuuuuu')
	->setPassword('ppppppppp')
	;

// 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:";
	print_r($failures);
}	


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

?>
Edited by gcraill
Link to comment
https://forums.phpfreaks.com/topic/275488-swiftmailer-gining-500-error/
Share on other sites

Update:

 

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 
>> AUTH LOGIN 
<< 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 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.