Getting it to work
Posted: Sat Nov 15, 2008 6:45 pm
I'm a newbie at php, have been able to get
the data side of my site running, however less
success with email side, tried PEAR and then
came across swift.
Here is my (actually your code- thank you!) code:
<?php
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once "lib/Swift/Authenticator/LOGIN.php";
// used the correct smtp, username, and password for runtime
$smtp =& new Swift_Connection_SMTP("smtp.myprovider.net");
$smtp->setUsername("user");
$smtp->setPassword("pass");
$smtp->attachAuthenticator(new Swift_Authenticator_LOGIN());
$swift =& new Swift($smtp);
//Create the message
$message =& new Swift_Message("My subject", "My body");
//Now check if Swift actually sends it
if ($swift->send($message, "charles_bristoll@centum.ca", "bristoll@trigger.net")) echo "Sent";
else echo "Failed";
?>
Here is the error message:
Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [smtp.trigger.net:25]: fsockopen returned Error Number 10060 and Error String 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. '' in C:\Program Files\wamp\www\lib\Swift\Connection\SMTP.php:309 Stack trace: #0 C:\Program Files\wamp\www\lib\Swift.php(216): Swift_Connection_SMTP->start() #1 C:\Program Files\wamp\www\lib\Swift.php(101): Swift->connect() #2 C:\Program Files\wamp\www\emailtest.php(23): Swift->__construct(Object(Swift_Connection_SMTP)) #3 {main} thrown in C:\Program Files\wamp\www\lib\Swift\Connection\SMTP.php on line 309
I can't seem to figure out why it is not connecting.
Thank you!
the data side of my site running, however less
success with email side, tried PEAR and then
came across swift.
Here is my (actually your code- thank you!) code:
<?php
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once "lib/Swift/Authenticator/LOGIN.php";
// used the correct smtp, username, and password for runtime
$smtp =& new Swift_Connection_SMTP("smtp.myprovider.net");
$smtp->setUsername("user");
$smtp->setPassword("pass");
$smtp->attachAuthenticator(new Swift_Authenticator_LOGIN());
$swift =& new Swift($smtp);
//Create the message
$message =& new Swift_Message("My subject", "My body");
//Now check if Swift actually sends it
if ($swift->send($message, "charles_bristoll@centum.ca", "bristoll@trigger.net")) echo "Sent";
else echo "Failed";
?>
Here is the error message:
Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [smtp.trigger.net:25]: fsockopen returned Error Number 10060 and Error String 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. '' in C:\Program Files\wamp\www\lib\Swift\Connection\SMTP.php:309 Stack trace: #0 C:\Program Files\wamp\www\lib\Swift.php(216): Swift_Connection_SMTP->start() #1 C:\Program Files\wamp\www\lib\Swift.php(101): Swift->connect() #2 C:\Program Files\wamp\www\emailtest.php(23): Swift->__construct(Object(Swift_Connection_SMTP)) #3 {main} thrown in C:\Program Files\wamp\www\lib\Swift\Connection\SMTP.php on line 309
I can't seem to figure out why it is not connecting.
Thank you!