From: Andrzej Adam Filip on
Ben Morrow <ben(a)morrow.me.uk> wrote:
> 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 do agree that "external messing with ISA is not very polite" :-)

Another *dirty* hack to test is to make Net::SMTP use IO::Socket::SSL
instead of IO::Socket::INET and use SMTPS connection to SMTPS (465)
port [AFAIR I have been able to make Net::NNTP "support" NNTPS but I
have conducted a little more than basic tests ].

use MIME::Lite;
use Net::SMTP;
BEGIN { grep{ s/^IO::Socket::INET$/IO::Socket::SSL/ || 1 } @Net::SMTP::ISA }
....
MIME::Lite->send('smtp','smtp.gmail.com',Port=>465,...);

--
[pl>en Andrew] Andrzej Adam Filip : anfi(a)onet.eu : Andrzej.Filip(a)gmail.com
Genius is pain.
-- John Lennon
From: Chris Nehren on
On 2010-06-19, Andrzej Adam Filip scribbled these curious markings:
> use MIME::Lite;
> use Net::SMTP;
> BEGIN { grep{ s/^IO::Socket::INET$/IO::Socket::SSL/ || 1 } @Net::SMTP::ISA }
> ...
> MIME::Lite->send('smtp','smtp.gmail.com',Port=>465,...);

Why monkeypatch when there are robust libraries already written to do
the job?

Also, you're abusing grep for side effects.

--
Thanks and best regards,
Chris Nehren
Unless noted, all content I post is CC-BY-SA.