HELP!!! Google Apps and Swift
Posted: Mon Oct 27, 2008 6:01 pm
Hi,
I am pretty new to PHP.... and I am running this script locally (from my comp)...
i can't SOLVE the problems i have with this simple script...
I am running this with PHP5
My host is iPower and i use google apps (gmail) to do my emails.
User/Password are edited out
If i dun comment out the /*Swift_connectino_SMTP::ENC_TLS, i get :
I tried running on my hosting server (with PHP4)... which is worse... nothing showed.. everything disappeared= not working...
I am pretty new to PHP.... and I am running this script locally (from my comp)...
i can't SOLVE the problems i have with this simple script...
I am running this with PHP5
My host is iPower and i use google apps (gmail) to do my emails.
User/Password are edited out
Code: Select all
<?
//Load in the files we'll need
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
$swift = new Swift(new Swift_Connection_SMTP(
"smtp.gmail.com", Swift_Connection_SMTP::PORT_SECURE /*Swift_Connection_SMTP::ENC_TLS*/));
$smtp->setUsername("MYUSER");
$smtp->setpassword("********");
$swift = new Swift($smtp);
$message =& new Swift_Message("My subject", "My body");
$sent = $swift->send($message, "me@me.com", "myuser@mydomain.com");
echo "Sent to $sent recipients";
?>
if i comment out that... i get a much bigger mess...Fatal error: Call to a member function setUsername() on a non-object in C:\AppServ\www\swift\test.php on line 7
Anyone know why???Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'There was a problem reading line 1 of an SMTP response. The response so far was:<br />[]. It appears the connection has died without saying goodbye to us! Too many emails in one go perhaps? (fsockopen: #0) ' in C:\AppServ\www\swift\lib\Swift\Connection\SMTP.php:250 Stack trace: #0 C:\AppServ\www\swift\lib\Swift.php(306): Swift_Connection_SMTP->read() #1 C:\AppServ\www\swift\lib\Swift.php(217): Swift->command('', 220) #2 C:\AppServ\www\swift\lib\Swift.php(101): Swift->connect() #3 C:\AppServ\www\swift\test.php(6): Swift->__construct(Object(Swift_Connection_SMTP)) #4 {main} thrown in C:\AppServ\www\swift\lib\Swift\Connection\SMTP.php on line 250
I tried running on my hosting server (with PHP4)... which is worse... nothing showed.. everything disappeared= not working...