I have following code to send an email in Perl:
#!/usr/bin/perl
use MIME::Lite;
$to = 'toid@domain.com';
$cc = 'ccid@domain.com';
$from = 'fromid@domain.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,
Data => $message
);
$msg->send;
#$msg->send('smtp', "smtp.gmail.com", AuthUser=>"myid@domain.com", AuthPass=>"mypass" );
#$msg->send('smtp', "smtp.gmail.com", Debug=>0 );
#$msg->send('type',@args);
print "Email Sent Successfully
";
When I run it I get the following error:
SMTP Failed to connect to mail server:
When I call $msg->send
with arguments (see the commented lines above) I get the following error:
SMTP auth() command not supported on smtp.gmail.com
How can I fix this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…