CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Sending mail in HTML format



Dec 7, 2000, 9:28 PM

Post #1 of 3 (476 views)
Sending mail in HTML format Can't Post

Help!!!!!! I am trying to send mail in HTML format using Perl. I have tried using MIME::Lite but it doesnt seem to be working. It give me internal error 500 for the server. I do not control the server so I cannot install any software on the server side. Is it possible to let me know if I can send mail using MIME ( my ISP confirms that it is there). I am using the following code:

CODE STARTS HERE**************
use MIME::Lite;
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
$count = 0;
foreach $pair (@pairs)
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name=~ tr/+/ /;
$name=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
$count = $count + 1;
$ORDER{$count} = $name;
print "Content-type: text/html\n\n";
print "\n";
print "";
for ($i = 3; $i <= $count; $i++)
if ($FORM{$ORDER{$i}} ne "")
print "$ORDER{$i} = $FORM{$ORDER{$i}} \n";
print "\n";
$msg = MIME::Lite->new(
From =>$FORM{'Email'},
To =>$FORM{'recipient'},
Subject =>$FORM{'subject'},
Type =>'text/html',
Data =>"Html formatted Mail"
$msg->send('sendmail', "/usr/lib/sendmail -toi");

print "\n";
print "";
CODE END HERE***********

Pls help me out.
Regards and thnx in advance
Chandrika B


Dec 7, 2000, 11:16 PM

Post #2 of 3 (476 views)
Re: Sending mail in HTML format [In reply to] Can't Post

  use MIME::Lite;
$msg = MIME::Lite->new(
From => '',
To => '',
Cc => ',',
Subject => 'Perl',
Type => 'text/html',
Data => qq{ <body><font size=20 color=red>
YOU LOVE Perl!!!!!!!!!!!!!!!!!
</body> }




Dec 8, 2000, 1:48 AM

Post #3 of 3 (476 views)
Re: Sending mail in HTML format [In reply to] Can't Post

hello cure,
thanks for your suggestion.
i tried the code which you give. it's not working, my ISP provider says MIME is installed.
i don't have control on the server. Is there any other way to send mail in html format without using
MIME::Lite module. I tried it before without using MIME::Lite seeing example which was on training page
on this site. that is also not working. Can you give the code for this.
pls help me out.



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives