All,

I am trying to use the MIME::Lite::HTML package to email web pages and include e-mail attachments. I have no problems using MIME::Lite to send mail with attachments and no problem using MIME::Lite::HTML to send a web page.

I figured that MIME::Lite::HTML inherits from MIME::Lite so I thought I'd be able to use MIME Lite methods to add the attachments... but apparently I do not understand the mechanism well enough. Sorry if this is a dumb mistake, it's just been a long "short" week. ;-(

Most of the code is straight from the Module's DOCs.
Could someone tell me if what I want to do is "do-able" and if so what's wrong with the code.

Thanks

The Errors

Name "mailHTML::MIME::Lite" used only once; possible typo at mailhtml. +pl line 15. Can't call method "attach" on an undefined value at mailhtml.pl line 1 +5.

The Code

#!/usr/bin/perl -w use strict; use MIME::Lite; use MIME::Lite::HTML; my $mailHTML = new MIME::Lite::HTML From => 'Someone@anyplace.com', To => 'someoneelse@theirplace.com', Subject => 'Search here if you want!', 'X-Priority'=> 1, 'X-MSMail-Priority' => 'High', ; $mailHTML::MIME::Lite->attach( Type =>'text/html; charset="iso-8859-1" +', Data => '<b>Brought to you now!</b>', ); my $URL = 'http://google.com'; my $MIMEmail = $mailHTML->parse("$URL"); $MIMEmail->send_by_smtp('smtp-server.cfl.rr.com');

In reply to MIME Lite HTML with Attachments by knexus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.