添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
打盹的板栗  ·  当我尝试"用 Microsoft ...·  3 周前    · 
卖萌的枇杷  ·  Send Email with Java ...·  3 周前    · 
正直的手电筒  ·  Not sending email ...·  3 周前    · 
强悍的红烧肉  ·  not able to send ...·  3 周前    · 
火爆的凳子  ·  Viewing SMTP logs | ...·  3 周前    · 
严肃的鼠标  ·  中国贸易救济信息网·  4 周前    · 
买醉的野马  ·  ComboBox - WPF .NET ...·  4 月前    · 
酷酷的熊猫  ·  肿瘤 - 丁香园·  4 月前    · 
闯红灯的爆米花  ·  玫瑰小说网盗文 ...·  5 月前    · 
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.

如果输出以上信息说明已安装,如果还未安装,接下来进行安装。

通过浏览器打开 http://www.perl.org/get.html。

下载适用于 Unix/Linux 的源码包。

下载 perl-5.x.y.tar.gz 文件后执行以下操作。

$ tar -xzf perl-5.x.y.tar.gz
$ cd perl-5.x.y
$ ./Configure -de
$ make
$ make test
$ make install

可完成安装接下来我们如果 perl -v 命令查看是否安装成功。

安装perl后默认安装Net::SMTP模块,但没有安装Net::SMTP_auth模块,需要另外安装

Net::SMTP_auth要用到Digest::HMAC_MD5和Authen::SASL

Net::SMTP_auth下载: https://metacpan.org/pod/Net::SMTP_auth

Digest::HMAC_MD5 下载: https://metacpan.org/pod/Digest::HMAC_MD5

Authen::SASL 下载: https://metacpan.org/pod/distribution/Authen-SASL/lib/Authen/SASL.pod

所有perl模块都可以在http://search.cpan.org找到下载,下载后解开安装包,安装方式都一样

perl Makefile.PL
make install

如上操作可完成安装

Perl 脚本编写

vim sendmail.pl

#!/usr/bin/perl -w  
use Net::SMTP_auth;
use strict;
my $mailhost = 'smtp.163.com';  #发送服务器
my $mailfrom = '[email protected]';  #发送者邮箱
my @mailto   = ('[email protected]'); #接受者 邮箱
my $subject  = 'nginx出现异常';
my $text = "亲爱的xx:\n 您好!77nginx出现异常,请及时查看!";
my $user   = '[email protected]';  #发送者邮箱
my $passwd = '1234566';
&SendMail();
## Send notice mail  
sub SendMail() {
    my $smtp = Net::SMTP_auth->new( $mailhost, Timeout =>520, Debug => 1 )  or die "Error.\n";
       $smtp->auth( 'LOGIN', $user, $passwd );
       foreach my $mailto (@mailto) {
                $smtp->mail($mailfrom);
                $smtp->to($mailto);
                $smtp->data();
                $smtp->datasend("To: $mailto\n");
                $smtp->datasend("From:$mailfrom\n");
                $smtp->datasend("Subject: $subject\n");
                $smtp->datasend("\n");
                $smtp->datasend("$text\n\n");
                $smtp->dataend();
       $smtp->quit;

添加可执行权限:chmod +x senmail.pl;

执行:perl sendmail.pl或./sendmail.pl

http://www.runoob.com/perl/perl-environment.html

https://metacpan.org/pod/Net::SMTP_auth

https://metacpan.org/pod/Net::SMTP_auth

一般来说,应用系统都需要发送邮件,提供一个认证的邮箱帐号和密码是很常见的。但是,有的客户方是内网直连邮箱服务器的,不需要通过帐号密码认证发送邮件,这样的话,理论上将 mail.smtp.auth 属性配置为 false 就可以了。 mail.smtp.auth 是控制邮件发送是是否需要进行登录认证的: true 表示需要身份验证 false 表示不需要身份验证 通过 JavaMailSenderImpl 的 setJavaMailProperties 方法来设置该属性。 JavaMailSe
公司经常遇到发送邮件的问题,普通邮件发送就不说了,说一下无账号密码发送邮件的过程,在这里总结一下: 邮件收发协议:发送邮件使用smtp协议,收取邮件使用pop或imap协议;这里我们只讲发送邮件smtp协议; smtp发送邮件过程 这部分说明是从网上摘抄的,写的很详细,我就贴过来修改了一下: 使用smtp协议发送邮件给邮件服务器时规定了要做以下几件事:   1、使用"ehlo"命令和连...
java.net.SocketTimeoutException: Read timed out 超时异常。 通过mail.smtp.timeout来设置超时时间,它的单位是毫秒。 mail.smtp.timeout =3000 javax.mail.AuthenticationFailedException: 535 Err... 本文简单介绍了SMTP协议(RFC2554)发送邮件的过程,并讨论了在 .NET 中使用SMTP发送邮件由简到繁的三种不同方案、各自可能遇到的问题及其解决办法。 -------------------------------------------------------------------------------- .NET的SMTP类 .使用CDO组件发送邮件 .使用Socket撰写邮件发送程序 .更多的信息 -------- &lt;dependency&gt;             &lt;groupId&gt;javax.mail&lt;/groupId&gt;             &lt;artifactId&gt;mail&lt;/artifactId&gt;             &lt;version&gt;1.4... <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> <version>1.4</version> </dependency> <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:.
使用javamail发送邮件时,如果smtp服务器需要身份验证,我们需要继承 javax.mail.Authenticator自己实现一个类,该类覆盖getPasswordAuthentication() 方法,返回一个包含用户名、口令信息的PasswordAuthentication,然后 在获取Session时指定这个我们自己实现的类。同时我们还需要指定"mail.smtp.auth" ...
my $mailhost = 'smtp.163.com'; my $mailfrom = '[email protected]'; my @mailto = ('[email protected]'); my $user = '[email protected]'; my $passwd = '14
perl(extutils::makemaker)是一个Perl模块,用于生成Makefile文件的工具。它是构建和安装Perl模块所必需的。在这个特定的情况下,错误信息显示perl-cpan软件包需要perl(extutils::makemaker)模块的支持。 CPAN是Comprehensive Perl Archive Network的缩写,是一个Perl语言的软件仓库和分发系统。它包含了大量的Perl模块和程序,可以通过CPAN来获取和安装这些模块。 在CentOS 7.9操作系统中安装perl-cpan软件包时,系统检测到该软件包依赖于perl(extutils::makemaker)模块。因此,系统需要先安装perl(extutils::makemaker)模块,然后才能成功安装perl-cpan软件包。 要解决这个问题,你可以按照以下步骤操作: 1. 打开终端,以root用户身份登录系统。 2. 运行以下命令来安装perl(extutils::makemaker)模块: yum install 'perl(extutils::makemaker)' 3. 系统将会下载并安装perl(extutils::makemaker)模块及其相关依赖。 4. 安装完成后,再次尝试安装perl-cpan软件包。 通过安装perl(extutils::makemaker)模块,你将满足perl-cpan软件包的依赖需求,并能够成功安装它。