[Chicago-talk] Sending an email via gmail using MIME::Lite

Don Drake don at drakeconsult.com
Sat Dec 13 07:49:49 PST 2008


I tried it and I can connect just fine:

$ ./gm.pl
MIME::Lite::SMTP>>> MIME::Lite::SMTP
MIME::Lite::SMTP>>>   Net::SMTP(2.31)
MIME::Lite::SMTP>>>     Net::Cmd(2.29)
MIME::Lite::SMTP>>>       Exporter(5.58)
MIME::Lite::SMTP>>>     IO::Socket::INET(1.29)
MIME::Lite::SMTP>>>       IO::Socket(1.29)
MIME::Lite::SMTP>>>         IO::Handle(1.25)
MIME::Lite::SMTP=GLOB(0x8afc84)<<< 220 mx.google.com ESMTP  
k29sm1647585qba.7
MIME::Lite::SMTP=GLOB(0x8afc84)>>> EHLO domain.com
MIME::Lite::SMTP=GLOB(0x8afc84)<<< 250-mx.google.com at your service,  
[24.13.161.70]
MIME::Lite::SMTP=GLOB(0x8afc84)<<< 250-SIZE 35651584
MIME::Lite::SMTP=GLOB(0x8afc84)<<< 250-8BITMIME
MIME::Lite::SMTP=GLOB(0x8afc84)<<< 250-STARTTLS
MIME::Lite::SMTP=GLOB(0x8afc84)<<< 250 ENHANCEDSTATUSCODES
MIME::Lite::SMTP=GLOB(0x8afc84)>>> MAIL FROM:<jay at duetloans.com>
MIME::Lite::SMTP=GLOB(0x8afc84)<<< 530 5.7.0 Must issue a STARTTLS  
command first. k29sm1647585qba.7
SMTP mail() command failed:
5.7.0 Must issue a STARTTLS command first. k29sm1647585qba.7

Make sure you don't have a firewall blocking your connection (try  
telnet to debug [telnet smtp.gmail.com 465]).  Or you might be on a  
RBL and they aren't accepting connections from your location.

-Don

--
Don Drake
www.drakeconsulting.com
www.maillaunder.com
312-560-1574
800-733-2143



On Dec 13, 2008, at 7:30 AM, Jay Strauss wrote:

> Hi, I would have thought this would be well worn territory on google,
> but I could not find out how to do this.  Maybe its so elementary no
> one posted an example.
>
> I can seem to send an email via MIME::Lite using gmail's smtp.  Here
> is what I have and get:
>
> #!/usr/bin/perl
>
> use strict;
> use MIME::Lite;
>
> my $smtp_server = "smtp.gmail.com";
> my $smtp_port   = 465;
> my $debug       = 1;
> my $user        = "user";
> my $passwd      = "password";
>
> MIME::Lite->send('smtp', $smtp_server ,
>                          Port =>$smtp_port ,
>                          Timeout=>60 ,
>                          Debug => $debug ,
>                          Hello => 'domain.com',
>                          User  => $user,
>                          Password  => $passwd);
>
> my $msg = MIME::Lite->new(
>        From    =>'jay at duetloans.com',
>        To      =>'me at heyjay.com',
>        Subject =>'This is a test',
>        Data    =>"this is the body"
>        );
>
> $msg->send();
>
> When I run it:
> jstrauss at neon:~/bin$ email.pl
> MIME::Lite::SMTP>>> MIME::Lite::SMTP
> MIME::Lite::SMTP>>>   Net::SMTP(2.29)
> MIME::Lite::SMTP>>>     Net::Cmd(2.26)
> MIME::Lite::SMTP>>>       Exporter(5.58)
> MIME::Lite::SMTP>>>     IO::Socket::INET(1.29)
> MIME::Lite::SMTP>>>       IO::Socket(1.29)
> MIME::Lite::SMTP>>>         IO::Handle(1.25)
> MIME::Lite::SMTP=GLOB(0x83c9fd4): Timeout at
> /usr/share/perl5/MIME/Lite.pm line 2634
> Failed to connect to mail server: Bad file descriptor
> at /home/jstrauss/bin/email.pl line 27
>
> I feel its probably not connecting properly, but I don't see what to  
> do.
> Thanks
> Jay
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20081213/ff3ba535/attachment.html>


More information about the Chicago-talk mailing list