sendEmail -- invalid SSL_version at SSL.pm
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sendEmail -- invalid SSL_version at SSL.pm相关的知识,希望对你有一定的参考价值。
sendEmail实现邮件发送,遭遇invalid SSL_version,同时对于使用腾讯的免费企业邮箱也有一些问题,下面是故障描述及解决方案。
1、故障现象
[[email protected]_106_88_centos ~]# sendEmail -f [email protected] -t [email protected] -s smtp.163.com -u "i am the subject" -o message-content-type=html -o message-charset=utf8 -xu [email protected] -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、环境
[[email protected]_106_88_centos ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
二、解决方案
1、SSL.pm文件415行
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、解决方案
a、卸载现有的perl版本,安装老版本(不推荐) b、增加参数-o tls=no 选项 [[email protected]_106_88_centos ~]# sendEmail -f [email protected] -t [email protected] -s smtp.163.com -u "i am the subject" -o message-content-type=html -o message-charset=utf8 -xu [email protected] -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/Software/SendEmail/sendEmail-v1.56.tar.gz
2.解压软件
tar zxf sendEmail-v1.56.tar.gz -C /usr/src
3.进入目录
cd /usr/src/sendEmail-v1.56
4.复制文件,并设置权限
cp -a sendEmail /usr/local/bin chmod +x /usr/local/bin/sendEmail
5.安装组件
yum install perl-Net-SSLeay perl-IO-Socket-SSL -y
6.测试邮件功能
# /usr/local/bin/sendEmail -f [email protected] -t [email protected] -s smtp.163.com -u "我是邮件主题" -o message-content-type=html -o message-charset=utf8 -xu [email protected] -xp 123456 -m "我是邮件内容"
命令说明:
/usr/local/bin/sendEmail 命令主程序 -f [email protected] 发件人邮箱 -t [email protected] 收件人邮箱 -s smtp.163.com 发件人邮箱的smtp服务器 -u "我是邮件主题" 邮件的标题 -o message-content-type=html 邮件内容的格式,html表示它是html格式 -o message-charset=utf8 邮件内容编码 -xu [email protected] 发件人邮箱的用户名 -xp 123456 发件人邮箱密码 -m "我是邮件内容" 邮件的具体内容
以上是关于sendEmail -- invalid SSL_version at SSL.pm的主要内容,如果未能解决你的问题,请参考以下文章
sendEmail报错:at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm