Reputation: 1
I'm trying to send mails using classic PHP scripts. Mail() version :
<?php
ini_set('SMTP', 'srv-****.fr');
ini_set('smtp_port', '25');
$to = '[email protected]';
$subject = 'TestMail PHP';
$message = 'Hello just testing please ignore';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo('OK');
?>
Swift Mailer Version
<?php
// Test mail with swift
require_once 'swiftmailer-master/lib/swift_required.php';
// Create the Transport
$transport = Swift_SmtpTransport::newInstance('srv-****.fr', 25);
$mailer = Swift_Mailer::newInstance($transport);
// Create a message
$message = Swift_Message::newInstance('Test Swift')
->setFrom(array('[email protected]'))
->setTo('[email protected]')
->setBody(' Test, please ignore')
;
// Send the message
$result = $mailer->send($message);
echo('Test.');
?>
When I use a simple mail() function, my page loads 2 minutes. Then the mail takes another 2 minutes to pop in my inbox. That's waayy too long.
When I try using SwiftMailer, which timeouts after 30 seconds, I get this error:
Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection to srv-exchange.mpm.fr:25 Timed Out' in C:\wamp\www\tests\swiftmailer-master\lib\classes\Swift\Transport\AbstractSmtpTransport.php on line 407
( ! ) Swift_TransportException: Connection to srv-*****.fr:25 Timed Out in C:\wamp\www\tests\swiftmailer-master\lib\classes\Swift\Transport\AbstractSmtpTransport.php on line 407
Call Stack
# Time Memory Function Location
1 0.0010 241416 {main}( ) ..\mailSwift.php:0
2 0.0520 2737536 Swift_Mailer->send( ) ..\mailSwift.php:19
3 0.0520 2737960 Swift_Transport_AbstractSmtpTransport->start( ) ..\Mailer.php:80
4 0.0620 2754568 Swift_Transport_AbstractSmtpTransport->_readGreeting( ) ..\AbstractSmtpTransport.php:119
5 0.0620 2754736 Swift_Transport_AbstractSmtpTransport->_getFullResponse( ) ..\AbstractSmtpTransport.php:291
6 30.0660 2804816 Swift_Transport_AbstractSmtpTransport->_throwException( ) ..\AbstractSmtpTransport.php:409
What does it mean ? How could I solve it ?
Setup : Using a WAMP server on my local platform, which is in a society network. I'm using the SMTP server of my society.
EDIT AFTER TESTS TODAY: I called the IT guys, I think the problems comes from my WAMP configuration. Will come back to this post once I'm done finding what's messed up with my thing.
The IT guy saw the logs : 14h50 : incoming connexion from my IP adress -- nothing for 3min30 14H54 message delivered.
He ensured me there were no mass mail protections. My telnet works fine. I think the problem comes from WAMP.
Upvotes: 0
Views: 286
Reputation: 1
Okay, problem solved here's how :
After investigating, I found out that the problem was coming from MY setup, because absolutely everything was fine on the SMTP server side.
So I tried changing my WAMP environment : Switched to EasyPHP from wampserver.
Everything works fine now with EasyPHP, I hugely recomand using this development environment for WAMP/LAMP devs. http://www.easyphp.org/
Upvotes: 0