1

試した添付ファイル付きの perl を使用してメールを送信しようとしましたがEmail::StuffMIME::Lite実行時にエラーが発生したAuthentication failedか、サーバーが接続されていません。対応するコードは次のとおりです。

   use MIME::Lite;
use Net::SMTP;
### Adjust sender, recipient and your SMTP mailhost
my $from_address = 'atme04@gmail.com';
my $to_address = 'thiyagu040@gmail.com';
my $mail_host = 'smtp.gmail.com';

### Adjust subject and body message
my $subject = 'A message with 2 parts ...';
my $message_body = "Here's the attachment file(s) you wanted";
my $your_file_zip = 'my.zip';

$msg = MIME::Lite->new (
  From => $from_address,
  To => $to_address,
  Subject => $subject,
  Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
MIME::Lite->send('smtp', 'smtp.gmail.com' ,
                          Port =>465 ,
                          Timeout=>320 ,
                          Debug => 1 ,
                          Hello => $mail_host,
                          User  => $from_address,
                          Password  => 'Thiyagu.04' );
#$mime_msg->send() or die "Error sending message: $!\n";

#MIME::Lite->send('smtp',$mail_host,AuthUser=> $from_address, AuthPass=>"apssword");

$msg->send();

エラーメッセージは;

 SMTP Failed to connect to mail server: A connection attempt failed because the connected party did not properly respond aft
    er a period of time, or established connection failed because connected host has failed to respond.
     at mail.pl line 54.

前もって感謝します

4

1 に答える 1