使用 Perl 通过电子邮件发送附件
如果您想通过 Perl 在电子邮件中发送附件,则可以使用以下脚本 −
#!/usr/bin/perl use MIME::Lite; $to = '[email protected]'; $cc = '[email protected]'; $from = '[email protected]'; $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() 方法附加任意数量的文件。
广告