sendEmail -- invalid SSL_version at SSL.pm

  sendEmail實現郵件發送,遭遇invalid SSL_version,同時對於使用騰訊的免費企業郵箱也有一些問題,下面是故障描述及解決方案。

1、故障現象

[root@VM_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、環境

[root@VM_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 選項

[root@VM_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 "我是郵件內容"          郵件的具體內容


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章