#!/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 headerprint MAIL "To: $to\n";print MAIL "From: $from\n";print MAIL "Subject: $subject\n\n";## Mail Bodyprint 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);}
它在邮件中打印:
<HTML><body><p><b>Hello</b>This is a test message from Cyberciti.biz! You can write your</p></body></HTML>
像这样…因为它似乎没有将其转换为HTML格式.
所以请帮助我.
my $msg = MIME::lite->new( To => 'you@yourhost.com',Subject => 'HTML example',Type => 'text/HTML',Data => '<h1>Hello World!</h1>');$msg->send();总结
以上是内存溢出为你收集整理的从perl脚本以html格式发送邮件全部内容,希望文章能够帮你解决从perl脚本以html格式发送邮件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)