fatal error gmail connection

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
center
Forum Newbie
Posts: 1
Joined: Thu Dec 04, 2008 2:47 am

fatal error gmail connection

Post 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
gmorehoudh
Forum Commoner
Posts: 50
Joined: Tue Mar 04, 2008 1:49 pm

Re: fatal error gmail connection

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: fatal error gmail connection

Post 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?
gmorehoudh
Forum Commoner
Posts: 50
Joined: Tue Mar 04, 2008 1:49 pm

Re: fatal error gmail connection

Post 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!
Post Reply