I am working on unix environment and have a perl scrip to send mail, but i need to send HTML formatted mail,but it printing as it is html code. so could anyone please let me know how it manipulate or compile the html and send formatted mail.
#!/usr/bin/perl
#print "Content-type: text/html\n\n";
print("enter my name");
chop($name=<stdin>);
&mail();
sub mail{
$title='perl';
$to='abcd@acv.com';
$from= 'xyz@xyz.com';
$subject=$name;
open(MAIL, "|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
print MAIL $name;
print MAIL "<html><body><p>";
print MAIL "<b>Hello</b>";
print MAIL "This is a test message from Cyberciti.biz! You can write your";
print MAIL "</p></body></html>";
##print MAIL "$title";
close(MAIL);
}
Its printing in mail:
<html><body><p><b>Hello</b>This is a test message from Cyberciti.biz! You can write your</p></body></html>
like this...as it is seems its not converting it into html format. So please help me over this.