http://www.perlmonks.org?node_id=289446


in reply to MIME Lite HTML with Attachments

The docs for MIME::Lite::HTML don't make this clear at all, and I had to look at the source to suss what was going on...

M::L::H *doesn't* inherit from MIME::Lite - it just uses it....but the good news is that it returns a MIME::Lite object when you call the parse method, so what you actually want is this...

my $mailHTML = new MIME::Lite::HTML From => 'Someone@anyplace.com', # etc. ; my $MIMEmail = $mailHTML->parse('http://google.com'); $MIMEmail->attach( Type =>'text/html; etc. etc); $MIMEmail->send_by_smtp('smtp-server.cfl.rr.com');
Cheers,
Ben.

Replies are listed 'Best First'.
Re: Re: MIME Lite HTML with Attachments
by knexus (Hermit) on Sep 06, 2003 at 11:18 UTC
    Thanks benn, you just beat me to it. ;-)

    After getting some sleep, I started looking at the package source and it became clear that M::L::H contians a M::L and does NOT inherit from it.

    However, parse() returns a M::L for the caller to use for sending the email. That's when it HIT ME (doh!). I should have realized what was going on by how the send() was done, ie. via $MIMEmail and not $mailHTML.
    So, things are much better now... perhaps it was the sleep? ;-}

    Anyhow, that's just another one to add to the lessons learned list.
    Plus being new to perl, it's nice get confirmation from someone else, so many thanks for the reply.