[sllug-members]: Google Applications SMTP and PHP
James Noble
noblejames at gmail.com
Wed Nov 14 13:11:13 MST 2007
Yeah I got it working if you would like a working copy I can send it
to you. Thanks for the reply
On Nov 13, 2007 9:10 AM, Jon Fullmer <jon at jonfullmer.com> wrote:
> Have you tried making sure that you can even CONNECT to google using
> SMTP? Try a telnet test:
>
> telnet smtp.gmail.com 25
>
> If you don't get a connection, it could be that your ISP is preventing
> any outbound SMTP traffic to any address other than its own SMTP
> servers. This is a fairly common practice of ISPs to prevent the
> spread of e-mail worms and spammers (this is VERY common on public
> Internet access, say, at libraries, hotels, etc.). In these
> situations, you, as the customer, are typically allowed to relay
> anywhere you need to (i.e., connect to "ispmailserver.com", but are
> sending from "mydomain.com" to "myfriendsdomain.com", etc.).
>
> Anyway, check that. Your script may be okay, but you just may not be
> able to connect via SMTP, due to ISP restrictions.
>
> - Jon
>
>
> On Nov 12, 2007, at 11:56 PM, James Noble wrote:
>
> > Here is a working file. Hope it is useful.
> >
> > <?php
> > require_once "lib/Swift.php";
> > require_once "lib/Swift/Connection/SMTP.php";
> > require_once "lib/Swift/Authenticator/LOGIN.php";
> >
> > $conn =& new Swift_Connection_SMTP("smtp.gmail.com",465,
> > SWIFT_SMTP_ENC_TLS);
> > $conn->setUsername("my_email at google.com");
> > $conn->setPassword("my_password");
> > $conn->attachAuthenticator(new Swift_Authenticator_LOGIN());
> >
> > $swift =& new Swift($conn);
> > $message =& new Swift_Message("My Sub using delte comments", "My
> > body");
> >
> > $to =& new Swift_Address("to_someone at somewhere.com", "Jane");
> > $from =& new Swift_Address("from_someone at somewhereelse.com","John
> > Doe");
> >
> > //Now check if Swift actually sends it
> > if ($swift->send($message, $to, $from)) echo "Sent";
> > else echo "Failed";
> >
> > ?>
> >
> >
> > On Nov 12, 2007 6:48 PM, Michael Heath <mike.thomas.heath at gmail.com>
> > wrote:
> >> The first thing I notice is that, while I'm not familiar with Swift,
> >> it doesn't seem like you've taken into account that Google SMTP
> >> access
> >> requires STARTTLS/SSL access for SMTP. Thats a start - though, it
> >> doesn't really explain why the connection would be dropping dead with
> >> nothing sent, as STARTTLS comes after EHLO.
> >>
> >> I'd be really curious on how you get this to work. I hope my random
> >> comments might help some.
> >>
> >> Mike Heath
> >>
> >>
> >> On Nov 12, 2007 6:08 PM, James Noble <noblejames at gmail.com> wrote:
> >>> I was wondering if anyone has connected a php page to the google
> >>> applications smtp. I have tried to do this for a while but have
> >>> been
> >>> unable to send the email. The error I get is
> >>>
> >>> Uncaught Error of type [swift_connectionexception] with message
> >>> [There
> >>> was a problem reading line 1 of an SMTP response. The response so
> >>> far
> >>> was:
> >>> []. It appears the connection has died without saying goodbye to us!
> >>> Too many emails in one go perhaps? (fsockopen: #0) ]
> >>>
> >>> $smtp =& new Swift_Connection_SMTP("smtp.gmail.com", 465);
> >>> $smtp->setUsername("my_username at gmail.com");
> >>> $smtp->setpassword("my_password");
> >>>
> >>> $swift =& new Swift($smtp);
> >>> $message = "test";
> >>> if ($swift->send($message, "someone at gmail.com",
> >>> "someoneelse at gmail.com")) echo "Sent";
> >>> else echo "Failed";
> >>>
> >>> Any help would be appreciated.
> >>> ______________________________________________________________________
> >>> See http://www.sllug.org/ for latest SLLUG news, information, links.
> >>> Join SLLUG and other UT LUG members on irc.FreeNode.net channel
> >>> #Utah
> >>> sllug-members at sllug.org
> >>> http://www.sllug.org/cgi-bin/mailman/listinfo/sllug-members
> >>>
> >> ______________________________________________________________________
> >> See http://www.sllug.org/ for latest SLLUG news, information, links.
> >> Join SLLUG and other UT LUG members on irc.FreeNode.net channel #Utah
> >> sllug-members at sllug.org
> >> http://www.sllug.org/cgi-bin/mailman/listinfo/sllug-members
> >>
> > ______________________________________________________________________
> > See http://www.sllug.org/ for latest SLLUG news, information, links.
> > Join SLLUG and other UT LUG members on irc.FreeNode.net channel #Utah
> > sllug-members at sllug.org
> > http://www.sllug.org/cgi-bin/mailman/listinfo/sllug-members
> >
>
> ______________________________________________________________________
> See http://www.sllug.org/ for latest SLLUG news, information, links.
> Join SLLUG and other UT LUG members on irc.FreeNode.net channel #Utah
> sllug-members at sllug.org
> http://www.sllug.org/cgi-bin/mailman/listinfo/sllug-members
>
More information about the sllug-members
mailing list