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 thatThe 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('
[email protected]' => 'From me'))
->setTo(array('
[email protected]' => 'To Them','
[email protected]' => '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";
?>