Home > Archive > PERL Beginners > March 2004 > Sending email a HTML page
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Sending email a HTML page
|
|
|
| I want to send HTML file via
MIME::Lite
Is that practicable?
| |
| Paul D. Kraus 2004-03-29, 2:33 pm |
| You just attach the html page?
If you want to actually send an html email that is different and you should
perldoc MIME::Lite.
Html mail is blocked on a lot of peoples systems. I for one will not even open
a message that is not plain text. Just a suggestion.
Paul
On Monday 29 March 2004 02:59 am, John wrote:
> I want to send HTML file via
> MIME::Lite
>
> Is that practicable?
| |
| Zentara 2004-03-29, 4:31 pm |
| On Mon, 29 Mar 2004 10:59:18 +0300, isofroni@cc.uoi.gr (John) wrote:
>I want to send HTML file via
>MIME::Lite
>
>Is that practicable?
Yes, and you have alot of different ways to do it to.
Send the html mail, send the html as an attachment,
send html mail with inline photos, etc.
But remember that most people don't like html email,
so if you do send it, you should send a text email with
the html as an attachment.
Here is an example to send html mail with photo, notice
the necessary " cid: and Id " tags on the photo.
(Untested but should work)
#!/usr/bin/perl -w
# Send HTML document with inline images
use strict;
use MIME::Lite;
# Create a new MIME Lite object
my $msg = MIME::Lite->new(
From =>'foo@foo123.com',
To =>'whoever@wherever.com',
Subject =>'Hi',
Type =>'multipart/related');
my $text = "Hi, here is an email in text or html";
# Add your plain text
$msg->attach(
Type => 'text/plain',
Data => $text
);
# Add the body to your HTML message
$msg->attach(
Type => 'text/html',
Data => qq{ <BODY BGCOLOR=#FFFFFF>
<H2>Hi</H2>
<P ALIGN="left">
This is an HTML message.
</P>
<P ALIGN="left">
<A HREF="http://foo123.com/">Here's a link</A>.
</P>
<P ALIGN="middle">
<IMG SRC="cid:2uni2.jpg">
</P>
</BODY> });
# Attach the image
$msg->attach(Type => 'image/jpg',
Id => '2uni2.jpg',
Path => '2uni2.jpg');
# Send it
$msg->send();
__END__
########################################
############
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
|
|
|
|
|