Asuresh,
Basically, you need to add this line to the top of your email:
Content-type: text/html and send your email with HTML tags.
You have a couple of choices:
1. Here is a simple script for sending email using Perl. There is one
line in the middle which changes based on whether you are sending text
or HTML formatted email. The comments in the article describe how to
change the content type line.
http://www.tek-tips.com/gfaqs.cfm/lev2/4/lev3/32/pid/219/fid/364
2. Here is a script that sends email as both text and HTML (to deal
with everyone's mail reader). It assumes that you have Mail::Sendmail
available.
#!/usr/bin/perl
use Mail::Sendmail;
use strict;
my ($boundary,$html_email,$text_email,%email);
$boundary = 'allyourbasearebelongtous' . time;
$html_email = qq(<html>
<head><title>Email</title></head>
<body>
Hello world!
</body>
</html>
);
$text_email = qq(Hello world!\n);
%email = ( To => 'you@yours.org',
From => 'me@mine.org',
Subject => 'Hello world',
'MIME-Version' => 1.0,
'Content-type' => "multipart/alternative;
boundary=$boundary",
Message =>
qq(--$boundary
Content-type: text/plain; charset=UNKNOWN-8BIT
$text_email
--$boundary
Content-type: text/html; charset=iso-8859-1
$html_email
--$boundary--
)
);
sendmail(%email);
I found this script in a newsgroup posting whose URL is too long to
paste in here reliably. You can find it by searching Google Groups
using:
Perl send HTML email
3. Use the MIME::Lite module. Here is a link with tutorials and
example of sending email with different formatting and attachments,
including HTML.
About
http://perl.about.com/library/weekly/aa042302c.htm
Good luck with your script!
- Hammer |
Request for Answer Clarification by
asuresh-ga
on
06 Nov 2002 14:07 PST
"It assumes that you have Mail::Sendmail
available." My path for Sendmail is
"#!/usr/sbin/sendmail "
But I have diffrent path also there,
#!/usr/local/bin/perl
require DBI;
require Mysql::Statement;
require DBD::mysql;
It is not taking Sendmail, if I give bith paths, however it is working fine if
use "#!/usr/sbin/sendmail", but require DBI;
require Mysql::Statement;
require DBD::mysql;
these command fails.
Pelase let me know, how to include both paths.
-Suresh A
|