一、安装软件

1.安装sendmail

[root@lemontree1945 ~]# yum -y install sendmail

2.安装mailx

[root@lemontree1945 ~]# yum -y install mailx

二、修改配置文件 (把参数中对应的 邮箱设置成自己的邮箱)

[root@lemontree1945 ~]# vim /etc/mail.rc

set from=lemontree1945@163.com
        set smtp=smtps://smtp.163.com:465
        set smtp-auth-user=lemontree1945
        set smtp-auth-password=lemontree1945
        set smtp-auth=login

    注意事项:

    set smtp-auth-password:  该选项的设置需要,登录163邮箱,在设置中开放smtp和pop3

           设置的时候,会设置一个授权密码。  set smtp-auth-password=授权密码

    set smtp :这个选项的设置,一般smtp使用的是25端口,465端口是加密端口,

            由于本人使用的是阿里云的服务器,默认关闭了25端口,使用465端口

三、启动sendmail服务,设置开机自启动

[root@lemontree1945 ~]# systemctl restart sendmail

[root@lemontree1945 ~]# systemctl enable sendmail

四、进行发邮件测试

[root@lemontree1945 ~]# echo hello | mail -s "TEST" 731978638@qq.com
       [root@lemontree1945 ~]# Missing "nss-config-dir" variable.
      "/root/dead.letter" 11/302

. . . message not sent.

此时发现邮件发送失败了,原因是,使用了465端口,没有配置nss对应的目录

五、修改配置文件,添加如下两行内容:(在阿里云官网搜到的)

[root@lemontree1945 ~]# vim /etc/mail.rc

set from=lemontree1945@163.com
    set smtp=smtps://smtp.163.com:465
    set smtp-auth-user=lemontree1945
    set smtp-auth-password=lemontree1945
    set smtp-auth=login
    set ssl-verify=ignore

set nss-config-dir=/etc/pki/nssdb

六、重启服务测试,就可以了。

[root@lemontree1945 ~]# systemctl restart sendmail

[root@lemontree1945 ~]# echo hello | mail -s "TEST" 731978638@qq.com

centos7 使用sendmail 发送邮件相关推荐

  1. centos7使用sendmail发送邮件

    一.安装: 安装sendmail: yum -y install sendmail systemctl start sendmail 安装mailx: yum install -y mailx 二.发 ...

  2. Centos7 配置 sendmail、postfix 端口号25、465

    阿里云.腾讯云的操作系统 CentOS 6.x 和 CentOS 7.x 安装 sendmail.postfix 发送邮件时,会遇到无法使用25端口号发送邮件的问题. 本文分享米扑博客折腾了几天的研究 ...

  3. Linux sendmail发送邮件失败诊断案例(一)

    在新服务器上测试sendmail发送邮件时,发现邮件发送不成功,检查日志文件发现如下错误(Notice:由于涉及公司服务器,邮箱等,故下面hostname.邮箱地址等信息使用xxx代替) tail - ...

  4. centos下如何使用sendmail发送邮件

    最近在实施服务端日志监控脚本,需要对异常情况发送邮件通知相关责任人,记录下centos通过sendmail发送邮件的配置过程. 一. 安装sendmail和mailx 1.安装sendmail: 1) ...

  5. linux发邮件失败,Linux SendMail发送邮件失败诊断案例,sendmail发送邮件

    Linux SendMail发送邮件失败诊断案例,sendmail发送邮件 Linux上Sendmail经常由于一些配置问题,导致邮件发送失败,下面整理.收集了一些邮件发送失败.异常的案例. 案例1: ...

  6. 关于php使用sendmail发送邮件时中文附件名乱码问题解决方法

    问题描述:在php使用sendmail发送邮件时中文附件名出现乱码,如图: 原因分析:这是由于编码引起的错误. 解决办法:首先强制进行编码换: substr($file_name,strrpos($f ...

  7. Linux系统sendmail发送邮件

    sendmail是linux系统中一个邮箱系统,如果我们在系统中配置好sendmail就可以直接使用它来发送邮箱. sendmail的配置文件 /etc/mail/sendmail.cf :Sendm ...

  8. SendMail 发送邮件

    SendMail 发送邮件 using System; using System.Collections.Generic; using System.Linq; using System.Text; ...

  9. 在 linux 上使用 sendmail 发送邮件

    还是记录一个小点:如何在 linux上使用 sendmail发送邮件? 总共分为以下几个步骤: 1.安装 sendmail 在 CentOS上使用 yum即可安装,具体步骤略过 2.配置主机名 在 / ...

最新文章

  1. jdbc 日期时间相关的类型
  2. dropout的正则化理解
  3. CentOS7.3的基本配置(建议学习用)
  4. 【人工智能初级系列(一)】科学计算库 Numpy
  5. 加载jsp页面报#{} is not allowed in template text
  6. 【英语学习】【English L06】U04 Adventure L1 I want to watch a ballet show there
  7. 苹果召回部分产品;罗永浩锤子商城并入字节跳动;美团打车上线上海南京 | 极客头条...
  8. VB:您知道 Mid$ 函量可以放在 '=' 的左方吗
  9. 从二叉搜索树到平衡二叉搜索树
  10. 解决:Conversion to Dalvik format failed: Unable to execute dex: null
  11. transformClassesWithProfilers-transformForDebug
  12. 《计算机组成原理阅读笔记》
  13. 思科模拟器路由器常见问题及操作记录
  14. UML统一建模语言习题一
  15. 【转载】UWP应用设置和文件设置:科普
  16. 大数据和云计算有什么关系?
  17. SAP介绍:概念、核心、开发语言、优缺点与集成
  18. StreamX(1):StreamX概述
  19. 整理oracle Hints 用法大全
  20. ArcGIS Pro鹰眼图快速制图

热门文章

  1. 特征缩放的效果:从词袋到 TF-IDF
  2. 为什么脚本执行一行就不动了_在Linux中通过expect工具实现脚本的自动交互
  3. sql查询出的字段切割_SPL 简化 SQL 案例详解:多层固定分组
  4. 深度学习数据标注工具(转)
  5. 变量声明方式:let与var的区别
  6. uart怎么判断帧错误_UART通讯总线工作原理的理解--龚玉山
  7. python里面装数据库_python 安装操作 MySQL 数据库.
  8. robotframework自动化测试修炼宝典_自动化测试之框架Cucumber和RobotFramework的实战对比...
  9. tkinter显示mysql表_Python(Tkinter)如何只显示Mysql记录而不显示列表?
  10. KODExplorer可道云-资源管理器(芒果云)