From: Andrzej Adam Filip on
Ted Byers <r.ted.byers(a)gmail.com> wrote:
> I am using Activestate perl 5.10.0 on WXP, if that matters.
>
> I can get all the examples to work properly for trivially simple
> emails. However, the following:
>
> MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
> $pw, Timeout => 60);
>
> produces the error:
>
> SMTP auth() command not supported on smtp.gmail.com
>
> If I remove the credentials, I get an error about the need to
> establish a secure channel, specifically:
>
> SMTP mail() command failed:
> 5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45
> [...]

1) smtp.gmail.com offers support of AUTH command in SMTP session *AFTER*
receiving STARTTLS (after switching to encrypted connection).

#v+
.... Connecting to smtp.gmail.com via esmtp...
220 mx.google.com ESMTP x16sm15625549bku.5
>>> EHLO xxxx
250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
250-SIZE 35651584
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 PIPELINING
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO xxxx
250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250 PIPELINING
#v-

2) MIME::Lite uses Net::SMTP for sending via SMTP.

Net::SMTP due to its design requires non trivial rewrite to support both
encrypted and non encrypted connections.

Possible fix:
a) use MIME::Lite to compose the message $msg->as_string
b) send message using Net::SMTP::TLS module from CPAN
[ I have not used Net::SMTP::TLS myself ]

--
[pl>en Andrew] Andrzej Adam Filip : anfi(a)onet.eu : Andrzej.Filip(a)gmail.com
.... A solemn, unsmiling, sanctimonious old iceberg who looked like he
was waiting for a vacancy in the Trinity.
-- Mark Twain
From: Ted Byers on
On Jun 17, 4:05 pm, Andrzej Adam Filip <a...(a)onet.eu> wrote:
> Ted Byers <r.ted.by...(a)gmail.com> wrote:
> > I am using Activestate perl 5.10.0 on WXP, if that matters.
>
> > I can get all the examples to work properly for trivially simple
> > emails.  However, the following:
>
> >   MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
> > $pw, Timeout => 60);
>
> > produces the error:
>
> > SMTP auth() command not supported on smtp.gmail.com
>
> > If I remove the credentials, I get an error about the need to
> > establish a secure channel, specifically:
>
> > SMTP mail() command failed:
> > 5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45
> > [...]
>
> 1) smtp.gmail.com offers support of AUTH command in SMTP session *AFTER*
>    receiving STARTTLS (after switching to encrypted connection).
>
> #v+
> ... Connecting to smtp.gmail.com via esmtp...
> 220 mx.google.com ESMTP x16sm15625549bku.5>>> EHLO xxxx
>
> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
> 250-SIZE 35651584
> 250-8BITMIME
> 250-STARTTLS
> 250-ENHANCEDSTATUSCODES
> 250 PIPELINING>>> STARTTLS
>
> 220 2.0.0 Ready to start TLS>>> EHLO xxxx
>
> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
> 250-SIZE 35651584
> 250-8BITMIME
> 250-AUTH LOGIN PLAIN
> 250-ENHANCEDSTATUSCODES
> 250 PIPELINING
> #v-
>
> 2) MIME::Lite uses Net::SMTP for sending via SMTP.
>
> Net::SMTP due to its design requires non trivial rewrite to support both
> encrypted and non encrypted connections.
>
> Possible fix:
> a) use MIME::Lite to compose the message $msg->as_string
> b) send message using Net::SMTP::TLS module from CPAN
>    [ I have not used Net::SMTP::TLS myself ]
>
> --
> [pl>en Andrew] Andrzej Adam Filip : a...(a)onet.eu : Andrzej.Fi...(a)gmail.com
> ... A solemn, unsmiling, sanctimonious old iceberg who looked like he
> was waiting for a vacancy in the Trinity.
>   -- Mark Twain

Thanks Andrzej

So far so good. I have been able to connect to gmail and send plain
text email using Net::SMTP::TLS. However, I suspect there is a bug in
$msg->as_string because my logo.jpg is damaged, and the <img ...> tag
seems broken (i.e. the image does not appear in the right place in the
html body). This is in contrast to when I use the defaults in
MIME::Lite but the smtp services of my M$ Exchange server (the only
reason I am not using that server here is that the domain required for
sending is on the gmail email account).

Since MIME::Lite uses Net::SMTP, and I can use Net::SMTP::TLS to
connect to gmail, is there a way to tell MIME::Lite to use the sender
I make using Net::SMTP::TLS, or that it should use Net::SMTP::TLS
instead of Net::SMTP?

Thanks

Ted
From: Andrzej Adam Filip on
Ted Byers <r.ted.byers(a)gmail.com> wrote:
> On Jun 17, 4:05 pm, Andrzej Adam Filip <a...(a)onet.eu> wrote:
>> Ted Byers <r.ted.by...(a)gmail.com> wrote:
>> > I am using Activestate perl 5.10.0 on WXP, if that matters.
>>
>> > I can get all the examples to work properly for trivially simple
>> > emails.  However, the following:
>>
>> >   MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
>> > $pw, Timeout => 60);
>>
>> > produces the error:
>>
>> > SMTP auth() command not supported on smtp.gmail.com
>>
>> > If I remove the credentials, I get an error about the need to
>> > establish a secure channel, specifically:
>>
>> > SMTP mail() command failed:
>> > 5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45
>> > [...]
>>
>> 1) smtp.gmail.com offers support of AUTH command in SMTP session *AFTER*
>>    receiving STARTTLS (after switching to encrypted connection).
>>
>> #v+
>> ... Connecting to smtp.gmail.com via esmtp...
>> 220 mx.google.com ESMTP x16sm15625549bku.5>>> EHLO xxxx
>>
>> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
>> 250-SIZE 35651584
>> 250-8BITMIME
>> 250-STARTTLS
>> 250-ENHANCEDSTATUSCODES
>> 250 PIPELINING>>> STARTTLS
>>
>> 220 2.0.0 Ready to start TLS>>> EHLO xxxx
>>
>> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
>> 250-SIZE 35651584
>> 250-8BITMIME
>> 250-AUTH LOGIN PLAIN
>> 250-ENHANCEDSTATUSCODES
>> 250 PIPELINING
>> #v-
>>
>> 2) MIME::Lite uses Net::SMTP for sending via SMTP.
>>
>> Net::SMTP due to its design requires non trivial rewrite to support both
>> encrypted and non encrypted connections.
>>
>> Possible fix:
>> a) use MIME::Lite to compose the message $msg->as_string
>> b) send message using Net::SMTP::TLS module from CPAN
>>    [ I have not used Net::SMTP::TLS myself ]
>
> Thanks Andrzej
>
> So far so good. I have been able to connect to gmail and send plain
> text email using Net::SMTP::TLS. However, I suspect there is a bug in
> $msg->as_string because my logo.jpg is damaged, and the <img ...> tag
> seems broken (i.e. the image does not appear in the right place in the
> html body). This is in contrast to when I use the defaults in
> MIME::Lite but the smtp services of my M$ Exchange server (the only
> reason I am not using that server here is that the domain required for
> sending is on the gmail email account).
>
> Since MIME::Lite uses Net::SMTP, and I can use Net::SMTP::TLS to
> connect to gmail, is there a way to tell MIME::Lite to use the sender
> I make using Net::SMTP::TLS, or that it should use Net::SMTP::TLS
> instead of Net::SMTP?

*Test* the hack below to make MIME::Lite use Net::SMTP::TLS instead of
Net::SMTP:

use MIME::Lite;
use Net::SMTP::TLS;
BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::TLS); }

--
[pl>en Andrew] Andrzej Adam Filip : anfi(a)onet.eu : Andrzej.Filip(a)gmail.com
"Freedom is still the most radical idea of all."
-- Nathaniel Branden
From: Ted Byers on
On Jun 17, 5:59 pm, Andrzej Adam Filip <a...(a)onet.eu> wrote:
> Ted Byers <r.ted.by...(a)gmail.com> wrote:
> > On Jun 17, 4:05 pm, Andrzej Adam Filip <a...(a)onet.eu> wrote:
> >> Ted Byers <r.ted.by...(a)gmail.com> wrote:
> >> > I am using Activestate perl 5.10.0 on WXP, if that matters.
>
> >> > I can get all the examples to work properly for trivially simple
> >> > emails.  However, the following:
>
> >> >   MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
> >> > $pw, Timeout => 60);
>
> >> > produces the error:
>
> >> > SMTP auth() command not supported on smtp.gmail.com
>
> >> > If I remove the credentials, I get an error about the need to
> >> > establish a secure channel, specifically:
>
> >> > SMTP mail() command failed:
> >> > 5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45
> >> > [...]
>
> >> 1) smtp.gmail.com offers support of AUTH command in SMTP session *AFTER*
> >>    receiving STARTTLS (after switching to encrypted connection).
>
> >> #v+
> >> ... Connecting to smtp.gmail.com via esmtp...
> >> 220 mx.google.com ESMTP x16sm15625549bku.5>>> EHLO xxxx
>
> >> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
> >> 250-SIZE 35651584
> >> 250-8BITMIME
> >> 250-STARTTLS
> >> 250-ENHANCEDSTATUSCODES
> >> 250 PIPELINING>>> STARTTLS
>
> >> 220 2.0.0 Ready to start TLS>>> EHLO xxxx
>
> >> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
> >> 250-SIZE 35651584
> >> 250-8BITMIME
> >> 250-AUTH LOGIN PLAIN
> >> 250-ENHANCEDSTATUSCODES
> >> 250 PIPELINING
> >> #v-
>
> >> 2) MIME::Lite uses Net::SMTP for sending via SMTP.
>
> >> Net::SMTP due to its design requires non trivial rewrite to support both
> >> encrypted and non encrypted connections.
>
> >> Possible fix:
> >> a) use MIME::Lite to compose the message $msg->as_string
> >> b) send message using Net::SMTP::TLS module from CPAN
> >>    [ I have not used Net::SMTP::TLS myself ]
>
> > Thanks Andrzej
>
> > So far so good.  I have been able to connect to gmail and send plain
> > text email using Net::SMTP::TLS.  However, I suspect there is a bug in
> > $msg->as_string because my logo.jpg is damaged, and the <img ...> tag
> > seems broken (i.e. the image does not appear in the right place in the
> > html body).  This is in contrast to when I use the defaults in
> > MIME::Lite but the smtp services of my  M$ Exchange server (the only
> > reason I am not using that server here is that the domain required for
> > sending is on the gmail email account).
>
> > Since MIME::Lite uses Net::SMTP, and I can use Net::SMTP::TLS to
> > connect to gmail, is there a way to tell MIME::Lite to use the sender
> > I make using Net::SMTP::TLS, or that it should use Net::SMTP::TLS
> > instead of Net::SMTP?
>
> *Test* the hack below to make MIME::Lite use Net::SMTP::TLS instead of
> Net::SMTP:
>
> use MIME::Lite;
> use Net::SMTP::TLS;
> BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::TLS); }
>
> --
> [pl>en Andrew] Andrzej Adam Filip : a...(a)onet.eu : Andrzej.Fi...(a)gmail.com
> "Freedom is still the most radical idea of all."
>   -- Nathaniel Branden

Thanks, that changes things. But I get a different error:

Can't locate object method "supports" via package "MIME::Lite::SMTP"
at C:/Perl/site/lib/MIME/Lite.pm line 2872, <GEN3> line 7.

Does this tell you more than it tells me?

Thanks

Ted
From: Ben Morrow on

Quoth Ted Byers <r.ted.byers(a)gmail.com>:
> On Jun 17, 5:59�pm, Andrzej Adam Filip <a...(a)onet.eu> wrote:
> >
> > *Test* the hack below to make MIME::Lite use Net::SMTP::TLS instead of
> > Net::SMTP:
> >
> > use MIME::Lite;
> > use Net::SMTP::TLS;
> > BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::TLS); }
>
> Thanks, that changes things. But I get a different error:
>
> Can't locate object method "supports" via package "MIME::Lite::SMTP"
> at C:/Perl/site/lib/MIME/Lite.pm line 2872, <GEN3> line 7.

MIME::Lite is using the undocumented Net::SMTP method ->supports. This
is arguably a bug in MIME::Lite; OTOH changind a class's @ISA behind its
back isn't very polite either.

I would recommend using Email::Sender::Transport::SMTP::TLS, though it's
marked as alpha so you will want to test it thoroughly first.

Ben