I am working on a unix environment and have a perl script to send mail, but I need to send HTML formatted mail, but it prints like this is html code. so can someone please let me know how he manipulates or compiles html and sends 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); }
His print in the mail:
<html><body><p><b>Hello</b>This is a test message from Cyberciti.biz! You can write your</p></body></html>
like this ... because it seems like it is not turning it into html format. So please help me with this.
source share