#!perl
use warnings;
use strict;
use Net::SMTP;
my $smtpserver = 'server';
my $smtpport = 25;
my $smtpuser = 'username';
my $smtppassword = 'password';
my $smtp = Net::SMTP->new($smtpserver, Port=>$smtpport, Timeout => 10, Debug => 1);
die "Could not connect to server!\n" unless $smtp;
$smtp->auth($smtpuser, $smtppassword);
$smtp->mail('sender@example.com');
$smtp->to('mymail@gmail.com');
$smtp->data();
$smtp->datasend("To: mymail\@gmail.com\n");
$smtp->datasend("bla bla bla ... \n");
$smtp->quit;
当我执行此代码时,我得到了以下输出。我对perl的了解不多,但项目是Perl,所以我必须这样做。
下面发生了什么:我个人不理解。
Net::SMTP>>> Net::SMTP(2.29)
Net::SMTP>>> Net::Cmd(2.26)
Net::SMTP>>> Exporter(5.58)enter code here
Net::SMTP>>> IO::Socket::INET(1.27)
Net::SMTP>>> IO::Socket(1.28)
Net::SMTP>>> IO::Handle(1.24)
Net::SMTP=GLOB(0x7a6280)<<< 220 server ESMTP Sendmail 8.13.1/8.13.1; Sun, 6 Dec 2015 19:34:41 +0530
Net::SMTP=GLOB(0x7a6280)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x7a6280)<<< 250-server Hello localhost.localdomain [127.0.0.1], pleased to meet you
Net::SMTP=GLOB(0x7a6280)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x7a6280)<<< 250-PIPELINING
Net::SMTP=GLOB(0x7a6280)<<< 250-8BITMIME
Net::SMTP=GLOB(0x7a6280)<<< 250-SIZE
Net::SMTP=GLOB(0x7a6280)<<< 250-DSN
Net::SMTP=GLOB(0x7a6280)<<< 250-ETRN
Net::SMTP=GLOB(0x7a6280)<<< 250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5
Net::SMTP=GLOB(0x7a6280)<<< 250-DELIVERBY
Net::SMTP=GLOB(0x7a6280)<<< 250 HELP
Net::SMTP=GLOB(0x7a6280)>>> MAIL FROM:<sendermail>
Net::SMTP=GLOB(0x7a6280)<<< 250 2.1.0 <sendermail>... Sender ok
Net::SMTP=GLOB(0x7a6280)>>> RCPT TO:<receipient mail>
Net::SMTP=GLOB(0x7a6280)<<< 250 2.1.5 <recipient mail>... Recipient ok
Net::SMTP=GLOB(0x7a6280)>>> DATA
Net::SMTP=GLOB(0x7a6280)<<< 354 Enter mail, end with "." on a line by itself
Net::SMTP=GLOB(0x7a6280)>>> To: mymail@gmail.com
Net::SMTP=GLOB(0x7a6280)>>> .
Net::SMTP=GLOB(0x7a6280)<<< 250 2.0.0 tB6EJbum025820 Message accepted for delivery
Net::SMTP=GLOB(0x7a6280)>>> QUIT
Net::SMTP=GLOB(0x7a6280)<<< 221 2.0.0 server closing connection
我将非常感谢任何帮助 - 提前感谢。
答案 0 :(得分:3)
我不理解输出的错误
您没有向我们显示任何错误。正如您所看到的,服务器说&#34;消息接受交付&#34;。
缺少的yum install mysql mysql-server
可能意味着您正在发送空电子邮件。
下面发生了什么
正在发送电子邮件。同样,由于您使用->dataend