Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Send HTML File as an Attachement

by phildeman (Acolyte)
on Nov 16, 2007 at 14:03 UTC ( #651205=perlquestion: print w/ replies, xml ) Need Help??
phildeman has asked for the wisdom of the Perl Monks concerning the following question:

I like using MIME::Lite for sending e-mail. It's quick and simple. However, I would like to send an HTML file as an attachment. Has anyone submitted an HTML file as an attachment, using MIME::Lite? If yes, can you provide an example of your code? Or if not MIME::Lite, do you know of another Perl package that will send an HTML file as an attachment? Thanks for your help. -Phil-

Comment on Send HTML File as an Attachement
Re: Send HTML File as an Attachement
by TOD (Friar) on Nov 16, 2007 at 14:12 UTC
    declare it as 'text/plain'
    --------------------------------
    masses are the opiate for religion.
Re: Send HTML File as an Attachement
by bassplayer (Monsignor) on Nov 16, 2007 at 16:36 UTC

    I think MIME::Lite can do what you are asking. Check the docs here.

    The basic code (taken straight from that page) is:

    $msg = MIME::Lite->new( To =>'you@yourhost.com', Subject =>'HTML with in-line images!', Type =>'multipart/related' ); $msg->attach( Type => 'text/html', Data => qq{ <body> Here's <i>my</i> image: <img src="cid:myimage.gif"> </body> }, ); $msg->attach( Type => 'image/gif', Id => 'myimage.gif', Path => '/path/to/somefile.gif', ); $msg->send();
    Though you might not need the image parts.

    bassplayer

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://651205]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-12-21 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (105 votes), past polls