|
sendEmail实现邮件发送,遭遇invalid SSL_version,同时对于使用腾讯的免费企业邮箱也有一些问题,下面是故障描述及解决方案。1、故障现象1
2
3
4
5
6
7
8
9
10
11
12
13
| [iyunv@VM_106_88_centos ~]# sendEmail -f from@163.com -t to@qq.com -s smtp.163.com -u \
"i am the subject" -o message-content-type=html -o message-charset=utf8 \
-xu from@163.com -xp mypassword -m "i am the contenter"
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
together with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at /usr/local/bin/sendEmail line 1906.
invalid SSL_version specified at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 415.
|
2、环境1
2
| [iyunv@VM_106_88_centos ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
|
二、解决方案1、SSL.pm文件415行1
2
3
4
5
6
7
8
| 415 ${*$self}{'_SSL_ctx'} = IO::Socket::SSL::SSL_Context->new($arg_hash) || return;
# perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 29 registered patches, see perl -V for more detail)
由于在CentOS 7下perl的版本为5.16,而centos6.5的是5.10,版本不兼容
|
2、解决方案1
2
3
4
5
6
7
8
| a、卸载现有的perl版本,安装老版本(不推荐)
b、增加参数-o tls=no 选项
[iyunv@VM_106_88_centos ~]# sendEmail -f from@163.com -t to@qq.com -s smtp.163.com -u \
"i am the subject" -o message-content-type=html -o message-charset=utf8 \
-xu from@163.com -xp mypassword -m "i am the contenter" -o tls=no
Dec 27 16:16:34 localhost sendEmail[13958]: Email was sent successfully!
|
3、其他问题(腾讯免费邮箱不支持传统的smtp 25号端口方式========================================================================================
sendEmail的安装及使用方法:
1.下载软件 wget http://caspian.dotconf.net/menu/ ... dEmail-v1.56.tar.gz2.解压软件 tar zxf sendEmail-v1.56.tar.gz -C /usr/src3.进入目录 cd /usr/src/sendEmail-v1.564.复制文件,并设置权限 cp -a sendEmail /usr/local/binchmod +x /usr/local/bin/sendEmail5.安装组件 yum install perl-Net-SSLeay perl-IO-Socket-SSL -y6.测试邮件功能 # /usr/local/bin/sendEmail -f from@163.com -t to@qq.com -s smtp.163.com -u "我是邮件主题" -o message-content-type=html -o message-charset=utf8 -xu from@163.com -xp 123456 -m "我是邮件内容"命令说明: /usr/local/bin/sendEmail 命令主程序-f from@163.com 发件人邮箱-t to@163.com 收件人邮箱-s smtp.163.com 发件人邮箱的smtp服务器-u "我是邮件主题" 邮件的标题-o message-content-type=html 邮件内容的格式,html表示它是html格式-o message-charset=utf8 邮件内容编码-xu from@163.com 发件人邮箱的用户名-xp 123456 发件人邮箱密码-m "我是邮件内容" 邮件的具体内容
|
|