Page 1 of 1

fatal error gmail connection

Posted: Thu Dec 04, 2008 2:58 am
by center
hi

newbie here,

tried to send a form with this tutorial with a gmail smtp connection.
http://www.swiftmailer.org/wikidocs/v3/ ... /form2mail

gmail connection bit

$swift = new Swift(new Swift_Connection_SMTP("smtp.gmail.com", Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS));


$smtp =& new Swift_Connection_SMTP("smtp.gmail.com", 465);
$smtp->setUsername("itsme@gmail.com");
$smtp->setpassword("password");


$swift =& new Swift($smtp);


error_reporting(E_ALL); ini_set('display_errors', true);
trows this error.

please help.

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 /var/www/vhosts/huvema.nl/httpdocs/Swiftmail/lib/Swift/Connection/SMTP.php:250 Stack trace: #0 /var/www/vhosts/huvema.nl/httpdocs/Swiftmail/lib/Swift.php(306): Swift_Connection_SMTP->read() #1 /var/www/vhosts/huvema.nl/httpdocs/Swiftmail/lib/Swift.php(217): Swift->command('', 220) #2 /var/www/vhosts/huvema.nl/httpdocs/Swiftmail/lib/Swift.php(101): Swift->connect() #3 /var/www/vhosts/huvema.nl/httpdocs/request-invoice/handle_form.php(67): Swift->__construct(Object(Swift_Connection_SMTP)) #4 {main} thrown in /var/www/vhosts/huvema.nl/httpdocs/Swiftmail/lib/Swift/Connection/SMTP.php on line 250

Re: fatal error gmail connection

Posted: Fri Dec 05, 2008 3:09 pm
by gmorehoudh
First, it looks like you're creating the swift object twice, on the first line and then on the last line, so your code may not be doing what you think.

Second, I just tried telnetting to smtp.gmail.com port 465 and it didn't answer. Double check your code and also that you have the server parameters correct.

Re: fatal error gmail connection

Posted: Fri Dec 05, 2008 9:47 pm
by Chris Corbyn
This is more than likely going to be due to a firewall issue. smtp.gmail.com does respond on port 465:

Code: Select all

chrisbook:flippa chris$ telnet smtp.gmail.com 465
Trying 72.14.253.109...
Connected to gmail-smtp-msa.l.google.com.
Is it possible that your web host are blocking the connection?

Re: fatal error gmail connection

Posted: Mon Dec 08, 2008 1:25 pm
by gmorehoudh
How weird, I can connect fine from my VPS but not from work. We must have it firewalled for spam control or something. Ignore my earlier post!