in reply to Bad file descriptor with mail to Gmail using MIME::Lite.

I think Email::Send::Gmail is using Net::SMTP::SSL under the hood to connect to googlemail, whereas MIME::Lite is using plain (non-SSL) Net::SMTP.

Simply specifying the SSL SMTP port 465 with MIME::Lite isn't going to help, as (I suppose) googlemail expects to communicate via secured protocol, which MIME::Lite currently doesn't do...

(A couple of month ago, there was a thread about patching MIME::Lite to also support SSL/TLS on port 465/587 — but I'm not sure what to make of it :)

Update: it's probably easier to construct the (multipart) email using Email::MIME (instead of Email::Simple) and then send it with Email::Send::Gmail.

  • Comment on Re: Bad file descriptor with mail to Gmail using MIME::Lite.

Replies are listed 'Best First'.
Re^2: Bad file descriptor with mail to Gmail using MIME::Lite.
by rhubarbpie (Novice) on Jan 13, 2011 at 18:56 UTC
    Thank you for the suggestion. I'd thought of that and tried the following:
    use strict; use warnings; use Email::Send; use Email::Send::Gmail; use MIME::Lite; my $msg = MIME::Lite->new( From =>'bob@gmail.com', To =>'bob@gmail.com', Subject =>'test' ); my $sender = Email::Send->new( { mailer => 'Gmail', mailer_args=>[ username=>'bob@gmail.com',password=>'123456',] } ); eval { $sender->send($msg) }; die "Error sending email: $@" if $@;
    I receive no error, but the code immediately returns to a prompt and no mail is sent. I am somewhat new to this and assume you suggested I patch the "send" part (which works with Email::Simple::Creator) to my existing MIME code. Correct? Thoughts?
      ... Correct?

      Yes and no :)

      What I was thinking of was to replace Email::Simple::Creator with Email::MIME::Creator to create the msg, as the latter module is essentially the "multipart" extension of the former... from the same author, so chances are good that if Email::Simple::Creator works, the MIME variant might work, too.

        I had checked Email::MIME::Creator but it lists it as "obsolete do-nothing library." The "obsolete do-nothing part" scared me off. But I'll try it tonight as it's still listed as a module ...