#!/usr/bin/perl use Net::SMTP::SSL; use MIME::Entity; $from = 'test@test.com'; $to = 'hoge@hoge.com'; $password = 'testtest'; $subject = 'test'; $smtp = Net::SMTP::SSL->new('smtp.gmail.com', Port => 465, Debug => 1); $smtp->auth($from, $password); $smtp->mail($from . "\n"); $smtp->to($to . "\n"); $smtp->data(); $mime = MIME::Entity->build( From => $from, To => $to, Subject => $subject, Data => ['']); $mime->attach( Path => '/tmp/test1.tar.gz', Type => 'application/x-gtar', Encoding => 'Base64'); $mime->attach( Path => '/tmp/test2.tar.gz', Type => 'application/x-tar', Encoding => 'Base64'); $smtp->datasend($mime->stringify); $smtp->quit;
このスクリプトを動作させるには、たぶん下記のモジュールが必要。
Authen::SASL
Net::SMTP::SSL
Net::SMTP
IO::Socket::SSL
IO::Socket::INET
IO::Socket
IO::Handle
Exporter