sendEmail使用TLS发送邮件
SendEmail使用TLS发送邮件
在使用sendEmail启用tls发送邮件的时候出现
sendEmail[32136]: ERROR => No TLS support! SendEmail can't load required libraries. (try installing Net::SSLeay and IO::Socket::SSL)
我的CentOS 6.7,则安装
yum -y install perl-IO-Socket-SSL openssl-perl openssl-devel
即可
sendEmail报错:at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm
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/bin/sendEmail line 1906.
invalid SSL_version specified at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 415.
sendEmail发邮件的时候,出现的报错,然后查阅了很多资料
在http://caspian.dotconf.net/menu/Software/SendEmail/
上找到了 下面这段话
Q: I get the error "invalid SSL_version specified at /System/Library/Perl/Extras/5.16/IO/Socket/SSL.pm line 332.a on my Apple. What do I do?
A: Here's what I got from one user. It's a workaround until I put a real fix in:
> Fixed it by using Perl v5.12 that's still on OSX Mavericks. > (just changed sendEmail line 1 from #!/usr/bin/perl -w to #!/usr/bin/perl5.12 -w)
centos7.2默认是 perl的版本是5.16,centos6.5的是5.10,后来把7的版本换成5.10,就可以正常发邮件了。
perl安装
wget http://www.cpan.org/src/5.0/perl-5.10.0.tar.gz
tar -zxf perl-5.10.0.tar.gz
cd perl-5.22.0
./configure.gnu -des -Dprefix=/usr/local/perl
echo $?
make
make test
make install
mv /usr/bin/perl /usr/bin/perl.bak
ln -s /usr/local/perl/bin/perl /usr/bin/perl
perl -v
Reading message body from STDIN because the '-m' option was not used.
If you are manually typing in a message:
- First line must be received within 60 seconds.
- End manual input with a CTRL-D on its own line.
Feb 13 16:52:09 dw-hsd02-pe sendEmail[51053]: Message input complete.
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
possibly 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/sbin/sendEmail line 1906.
invalid SSL_version specified at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 444.
[root@dw-hsd02-pe 2019-02-13]# vim /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm
解决方法:
有两种方法修复问题:
1,不使用 TLS 加密
添加选项:-o tls=no
2,修改 sendEmail 脚本:
第 1906 行,将 'SSLv3 TLSv1' 修改为 'SSLv23:!SSLv2':