使用Perl通过电子邮件发送附件
如果您想使用Perl在电子邮件中发送附件,则以下脚本可达到以下目的:
#!/usr/bin/perl use MIME::Lite; $to = 'abcd@gmail.com'; $cc = 'efgh@mail.com'; $from = 'webmaster@yourdomain.com'; $subject = 'Test Email'; $message = 'This is test email sent by Perl Script'; $msg = MIME::Lite-=>new( From => $from, To => $to, Cc => $cc, Subject => $subject, Type => 'multipart/mixed' ); # Add your text message. $msg->attach( Type => 'text', Data => $message ); # Specify your file as attachement. $msg->attach(Type => 'image/gif', Path => '/tmp/logo.gif', Filename => 'logo.gif', Disposition => 'attachment' ); $msg->send; print "Email Sent Successfully\n";
您可以使用attach()方法在电子邮件中附加任意数量的文件。
热门推荐
10 看病贺卡祝福语简短英文
11 车行销售祝福语简短
12 国庆简短幽默祝福语
13 高温祝福语短语大全简短
14 参加儿子大学祝福语简短
15 学校职工祝福语大全简短
16 祖国七十华诞简短祝福语
17 月子小孩祝福语大全简短
18 春节后的祝福语简短