{"id":316,"date":"2022-09-06T21:05:11","date_gmt":"2022-09-06T13:05:11","guid":{"rendered":"https:\/\/www.jchj.top\/?p=316"},"modified":"2025-09-26T11:27:57","modified_gmt":"2025-09-26T03:27:57","slug":"%e9%98%bf%e9%87%8c%e4%ba%91%e4%b8%8a%e4%bd%bf%e7%94%a8mailx%e5%8f%91%e9%80%81%e9%82%ae%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.jchj.top\/?p=316","title":{"rendered":"\u963f\u91cc\u4e91\u4e0a\u4f7f\u7528mailx\u53d1\u9001\u90ae\u4ef6"},"content":{"rendered":"\n<p>\u963f\u91cc\u4e91\u4e0a\u4f7f\u7528mailx\u53d1\u9001\u90ae\u4ef6\u7684\u89e3\u51b3\u529e\u6cd5\uff0c\u9a8c\u8bc1\u53ef\u7528\u3002<\/p>\n\n\n\n<p>\u7531\u4e8e\u963f\u91cc\u4e91\u5df2\u5c0625\u7aef\u53e3\u5c01\u4e86\uff08\u6539\u7528465\u7aef\u53e3\uff09\uff0c\u6240\u4ee5\u5728ECS\u4e0a\u5f80\u5916\u53d1\u90ae\u4ef6\u65f6\u8981\u4f5c\u76f8\u5e94\u7684\u914d\u7f6e\u624d\u884c\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u7684\u662f163\u7684\u4f01\u4e1a\u90ae\u7bb1\u3002<\/p>\n\n\n\n<p>\u5728\u963f\u91cc\u4e91\u7684\u201c\u5b89\u5168\u7ec4\u201d\u5f00\u653e465\u7aef\u53e3\u901a\u884c<\/p>\n\n\n\n<p>\u5b89\u88c5\u76f8\u5e94\u7684\u8f6f\u4ef6\u5305 yum install mailx -y<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1119\" height=\"323\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/1-4.png\" alt=\"\" class=\"wp-image-317\"\/><\/figure>\n\n\n\n<p>\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6 vim \/etc\/mail.rc<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"206\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/2-4.png\" alt=\"\" class=\"wp-image-318\"\/><\/figure>\n\n\n\n<p>\u4e0b\u8f7d\u8bc1\u4e66\uff1a<\/p>\n\n\n\n<p>\u521b\u5efa\u8bc1\u4e66\u6587\u4ef6 mkdir \/root\/.luyou<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"687\" height=\"40\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/3-4.png\" alt=\"\" class=\"wp-image-319\"\/><\/figure>\n\n\n\n<p>&nbsp;&nbsp; \u5411163\u8bf7\u6c42\u8bc1\u4e66<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1278\" height=\"175\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/4-4.png\" alt=\"\" class=\"wp-image-320\"\/><\/figure>\n\n\n\n<p>\u6dfb\u52a0\u4e00\u4e2a\u8bc1\u4e66\u5230\u8bc1\u4e66\u6570\u636e\u5e93\u4e2d<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1051\" height=\"40\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/5-4.png\" alt=\"\" class=\"wp-image-321\"\/><\/figure>\n\n\n\n<p>&nbsp;&nbsp; \u4f7f\u8bc1\u4e66\u5f97\u5230\u8ba4\u53ef\uff0c\u907f\u514d\u53d1\u90ae\u4ef6\u540e\u62a5\u9519\uff1aError in certificate: Peer&#8217;s certificate issuer is not recognized<\/p>\n\n\n\n<p>cd \/root\/.luyou&nbsp;&nbsp; (\u4e00\u5b9a\u8981\u8fdb\u5165\u5230\u8bc1\u4e66\u6240\u5728\u76ee\u5f55\u624d\u884c)<\/p>\n\n\n\n<p>certutil -A -n &#8220;GeoTrust SSL CA &#8211; G3&#8221; -t &#8220;Pu,Pu,Pu&#8221;&nbsp; -d .\/ -i .\/163.crt<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"977\" height=\"59\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/6-3.png\" alt=\"\" class=\"wp-image-322\"\/><\/figure>\n\n\n\n<p>\u5217\u51fa\u76ee\u5f55\u4e0b\u8bc1\u4e66<\/p>\n\n\n\n<p>certutil -L -d \/root\/.luyou<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1049\" height=\"174\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/7-3.png\" alt=\"\" class=\"wp-image-323\"\/><\/figure>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; \u7ed9\u8bc1\u4e66\u6587\u4ef6\u52a0\u4e0a\u6743\u9650<\/p>\n\n\n\n<p>Chmod -R 755 .luyou\/*<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"67\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/8-3.png\" alt=\"\" class=\"wp-image-324\"\/><\/figure>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; Error in certificate: Peer&#8217;s certificate issuer is not recognized<\/p>\n\n\n\n<p>\u7531\u4e8e\u6b64\u670d\u52a1\u662f\u7ebf\u4e0a\u751f\u4ea7\u670d\u52a1\u5728\u5c1d\u8bd5\u5904\u7406\u62a5\u9519\u672a\u679c\u540e\u6682\u65f6\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u5904\u7406<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"963\" height=\"49\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/9-2.png\" alt=\"\" class=\"wp-image-325\"\/><\/figure>\n\n\n\n<p>\u4f8b<\/p>\n\n\n\n<p>\u7531\u4e8e\u963f\u91cc\u4e91\u5df2\u5c0625\u7aef\u53e3\u5c01\u4e86\uff08\u6539\u7528465\u7aef\u53e3\uff09\uff0c\u6240\u4ee5\u5728ECS\u4e0a\u5f80\u5916\u53d1\u90ae\u4ef6\u65f6\u8981\u4f5c\u76f8\u5e94\u7684\u914d\u7f6e\u624d\u884c\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u7684\u662f163\u7684\u4f01\u4e1a\u90ae\u7bb1\uff0c\u7b14\u8bb0\u7b80\u6d01\u53ef\u7528\u3002<\/p>\n\n\n\n<p>\u5728\u963f\u91cc\u4e91\u7684\u201c\u5b89\u5168\u7ec4\u201d\u5f00\u653e645\u7aef\u53e3\u901a\u884c\u3002<\/p>\n\n\n\n<p>1.\u5b89\u88c5\u76f8\u5e94\u8f6f\u4ef6\u5305\uff1a<\/p>\n\n\n\n<p>systemctl stop sendmail<\/p>\n\n\n\n<p>systemctl stop postfix<\/p>\n\n\n\n<p>systemctl disable sendmail<\/p>\n\n\n\n<p>systemctl disable postfix<\/p>\n\n\n\n<p>yum -y install mailx<\/p>\n\n\n\n<p>2.\u4e0b\u8f7d\u8bc1\u4e66\uff1a<\/p>\n\n\n\n<p>#\u521b\u5efa\u76ee\u5f55\uff0c\u7528\u6765\u5b58\u653e\u8bc1\u4e66<\/p>\n\n\n\n<p>mkdir -p \/root\/.certs\/<\/p>\n\n\n\n<p>#\u5411163\u8bf7\u6c42\u8bc1\u4e66<\/p>\n\n\n\n<p>echo -n|openssl s_client -connect smtp.qiye.163.com:465|sed -ne &#8216;\/-BEGIN CERTIFICATE-\/,\/-END CERTIFICATE-\/p&#8217; &gt; ~\/.certs\/163.crt<\/p>\n\n\n\n<p>#\u6dfb\u52a0\u4e00\u4e2a\u8bc1\u4e66\u5230\u8bc1\u4e66\u6570\u636e\u5e93\u4e2d<\/p>\n\n\n\n<p>certutil -A -n &#8220;GeoTrust SSL CA&#8221; -t &#8220;C,,&#8221; -d ~\/.certs -i ~\/.certs\/163.crt<\/p>\n\n\n\n<p>certutil -A -n &#8220;GeoTrust Global CA&#8221; -t &#8220;C,,&#8221; -d ~\/.certs -i ~\/.certs\/163.crt<\/p>\n\n\n\n<p>#\u4f7f\u8bc1\u4e66\u5f97\u5230\u8ba4\u53ef\uff0c\u907f\u514d\u53d1\u90ae\u4ef6\u540e\u62a5\u9519\uff1aError in certificate: Peer&#8217;s certificate issuer is not recognized<\/p>\n\n\n\n<p>cd \/root\/.certs &nbsp; (\u4e00\u5b9a\u8981\u8fdb\u5165\u5230\u8bc1\u4e66\u6240\u5728\u76ee\u5f55\u624d\u884c)<\/p>\n\n\n\n<p>certutil -A -n &#8220;GeoTrust SSL CA &#8211; G3&#8221; -t &#8220;Pu,Pu,Pu&#8221; &nbsp;-d .\/ -i .\/163.crt<\/p>\n\n\n\n<p>#\u5217\u51fa\u76ee\u5f55\u4e0b\u8bc1\u4e66<\/p>\n\n\n\n<p>certutil -L -d \/root\/.certs<\/p>\n\n\n\n<p>3.\u8ffd\u52a0\u914d\u7f6e\uff1a<\/p>\n\n\n\n<p>vim \/etc\/mail.rc<\/p>\n\n\n\n<p>set from=&#8221;zabbix@xxxxx.com&#8221;<\/p>\n\n\n\n<p>set smtp=&#8221;smtps:\/\/smtp.qiye.163.com:465&#8243;<\/p>\n\n\n\n<p>set smtp-auth-user=mail@xxxxx.com<\/p>\n\n\n\n<p>set smtp-auth-password=123456789<\/p>\n\n\n\n<p>set smtp-auth=login<\/p>\n\n\n\n<p>set ssl-verify=ignore<\/p>\n\n\n\n<p>set nss-config-dir=\/root\/.certs<\/p>\n\n\n\n<p>4.\u6d4b\u8bd5\u6548\u679c\uff1a<\/p>\n\n\n\n<p>echo &#8216;hello&#8217;|mail -v -s &#8220;test mail&#8221; human.hu@xxxxx.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u963f\u91cc\u4e91\u4e0a\u4f7f\u7528mailx\u53d1\u9001\u90ae\u4ef6\u7684\u89e3\u51b3\u529e\u6cd5\uff0c\u9a8c\u8bc1\u53ef\u7528&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,7,1],"tags":[],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-linux","category-7","category-1"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=316"}],"version-history":[{"count":1,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":326,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/316\/revisions\/326"}],"wp:attachment":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}