1.开启QQ邮箱SMTP服务

然后点击图片右下角生成授权码 ,获取到授权码

2.停止服务

此操作是在root用户下进行

[root@hadoop000 ~]# service sendmail stop
Redirecting to /bin/systemctl stop  sendmail.service
Failed to stop sendmail.service: Unit sendmail.service not loaded.
[root@hadoop000 ~]# chkconfig sendmail off
服务 sendmail 信息读取出错:没有那个文件或目录

3.启动postfix服务

此操作是在root用户下进行

# 启动postfix
[root@hadoop000 ~]# service postfix start
Redirecting to /bin/systemctl start  postfix.service
Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.# 查看postfix状态
[root@hadoop000 ~]# service postfix status
Redirecting to /bin/systemctl status  postfix.service
● postfix.service - Postfix Mail Transport AgentLoaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)# 这行表示启动失败了Active: failed (Result: exit-code) since 六 2019-08-24 16:55:03 CST; 1min 34s ago8月 24 16:55:01 hadoop000 systemd[1]: Starting Postfix Mail Transport Agent...
8月 24 16:55:01 hadoop000 aliasesdb[7204]: /usr/sbin/postconf: fatal: parameter i...:1
8月 24 16:55:02 hadoop000 aliasesdb[7204]: newaliases: fatal: parameter inet_inte...:1
8月 24 16:55:02 hadoop000 postfix/sendmail[7206]: fatal: parameter inet_interfaces...1
8月 24 16:55:02 hadoop000 postfix[7210]: fatal: parameter inet_interfaces: no loc...:1
8月 24 16:55:03 hadoop000 systemd[1]: postfix.service: control process exited, co...=1
8月 24 16:55:03 hadoop000 systemd[1]: Failed to start Postfix Mail Transport Agent.
8月 24 16:55:03 hadoop000 systemd[1]: Unit postfix.service entered failed state.
8月 24 16:55:03 hadoop000 systemd[1]: postfix.service failed.
Hint: Some lines were ellipsized, use -l to show in full.# 检查postfix问题
[root@hadoop000 ~]# postfix check
postfix: fatal: parameter inet_interfaces: no local interface found for ::1# 需要修改如下配置
[root@hadoop000 ~]# vi /etc/postfix/main.cf
...
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost
# 修改为
inet_interfaces = all# Enable IPv4, and IPv6 if supported
inet_protocols = all
...# 重新启动下postfix
[root@hadoop000 ~]# service postfix start
# 查看状态
[root@hadoop000 ~]# service postfix status
...
# 显示启动成功
Active: active (running) since 六 2019-08-24 17:02:08 CST; 10s ago
...# 配置开机自启动
[root@hadoop000 ~]# chkconfig postfix on
注意:正在将请求转发到“systemctl enable postfix.service”。

4.创建认证

此操作是在hadoop用户下

[hadoop@hadoop000 ~]$ mkdir -p ~/.certs/[hadoop@hadoop000 ~]$ echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt[hadoop@hadoop000 ~]$ certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt[hadoop@hadoop000 ~]$ certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt certutil -L -d ~/.certs[hadoop@hadoop000 ~]$ cd ~/.certs[hadoop@hadoop000 .certs]$ certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
# 出现这句话 表示配置成功了
Notice: Trust flag u is set automatically if the private key is present.

5.配置邮件发送者

此操作是在root用户下操作

[root@hadoop000 ~]$ vi /etc/mail.rc
set from=503757851@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=503757851
#授权码
set smtp-auth-password=xxxxxxxxxx
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/home/hadoop/.certs

6.测试

[hadoop@hadoop000 ~]$ echo hello word | mail -s " title" 503757851@qq.com

QQ邮箱收到邮件 即表示成功

7.生产使用

  • 发邮件不不带附件
EMAILFROM=503757851@qq.comEMAILTO=503757851@qq.com # 多个接受者用 , 分割echo -e "`date "+%Y-%m-%d %H:%M:%S"` : The current running $JOB_NAME job num is $RUNNINGNUM in 192.168.137.201 ......" | mail \
-r "From: alertAdmin <${EMAILFROM}>" \
-s "Warn: Skip the new $JOB_NAME spark job." ${EMAILTO}
  • 发邮件带附件
echo -e "`date "+%Y-%m-%d %H:%M:%S"` : Please to check the fail sql attachement."|mailx \
-r "From: alertAdmin <${EMAILFROM}>" \
-a error.log \
-s "Critical:KSSH fail sql." ${EMAILTO}

mail 465邮件配置相关推荐

  1. mail 465邮件发送案例

    文章预览: 1.先去QQ邮箱,开启pop3/IMAP获取授权码 2.安装mailx组件 3.调整参数 4.创建认证 5.配置邮件发送者 6.shell客户端测试 7.shell脚本测试 1.发邮件不带 ...

  2. java mail 503_邮件配置报503错误,发送失败

    $row 不是数组 你这个版本应该不是最新版,试着后台打印一下$row的值 这个最新版本的代码/** * 发送测试邮件 * @internal */ public function emailtest ...

  3. 如何配置SQL AgentMail与SQL Mail收发邮件

      如何配置SQL AgentMail与SQL Mail收发邮件 SQL AgentMail是负责在警告被触发时或是在预定作业成功或失败时发送通告的电子邮件服务:SQL Mail 是用来处理数据库应用 ...

  4. 使用SquirrelMail配置Webmail系统,并实现通Macallan Mail Solution邮件服务器的连接

    昨天已经完成了windows下的Macallan Mail Solution邮件服务器配置,已经能够通过Outlook正常使用邮件服务.今天的目的主要是搭建一个windows下的Webmail环境,方 ...

  5. exchange无法收发邮件_SpringBoot2.x系列教程69--SpringBoot中整合Mail实现邮件发送

    SpringBoot2.x系列教程69--SpringBoot中整合邮件发送 作者:一一哥 注: 本文案例以QQ邮箱发送的实现为例! 一. 邮件发送概述 1. 概述 在Spring框架中提供了一个Ja ...

  6. ibm邮箱连接不到服务器,IBM i 安全邮件配置和常见故障排除方法

    Body IBM i安全邮件配置和常见故障排除方法 简介:电子邮件是现在普遍使用的一种通信方式,为了提高通信过程中的安全并且保护邮件内容不被泄露,IBM i SMTP增加了对TLS的支持, 通过此技术 ...

  7. log4j2异步发送error日志邮件配置

    从高可用性方面考虑,大的平台通常都会配置错误日志发送邮件的功能,由于发送邮件比较慢,同步发邮件会影响用户体验,通常会配置成异步发日志邮件.网上只有零散的一些文章配置,没有一个完整的log4j2异步发邮 ...

  8. gitlab 邮件配置(smtp)

    gitlab 邮件配置(smtp) 2015-07-29 15:21:45 分类: 开源技术 一:修改全局配置文件 $ git config --GLOBAL user.name "geng ...

  9. SQL SERVER 数据库邮件配置

    1.简单了解数据库邮件的概念和使用的传输协议及系统体系: 数据库邮件是从 SQL Server 数据库引擎中发送电子邮件的企业解决方案.通过使用数据库邮件,数据库应用程序可以向用户发送电子邮件.邮件中 ...

最新文章

  1. Chrome_调试js出现Uncaught SyntaxError: Unexpected identifier
  2. 使用elk+redis搭建nginx日志分析平台(引)
  3. 关于VC中的stdafx.h
  4. java 递归生成格雷码_格雷码的递归生成
  5. 重置oracle 11G的system、sys密码
  6. 433M数传电台窄带无线通讯技术手册
  7. 升级xcode5.1 iOS 6.0后以前的横屏项目 变为了竖屏
  8. 手把手教你用原始方式上传项目至GitHub
  9. 暑期训练日志----2018.8.20
  10. php全套之一崭露头角(12天),PHP系列教程之一阶段崭露头角 (JS,bootstrap )
  11. 剑指offer--矩阵中的路径
  12. LINUX 查看分区UUID的两种方法
  13. php doss_ddos PHP版
  14. Kettle下载和安装
  15. 深度学习面试专用:深度学习500问;文字版吴恩达深度学习,机器学习
  16. OpenCV学习——摄像头人脸识别
  17. Industroyer:自震网病毒以来对工控系统的最大威胁
  18. 1分钟彻底搞懂关于nginx的proxy_pass
  19. prophet outliers异常值
  20. 断舍离---新生活方式指引

热门文章

  1. 泰坦尼克号-数据加载及探索性数据分析
  2. 墙裂推荐!看完全面掌握,最详细的 Docker 学习笔记总结(2021最新版)
  3. 达梦数据库之TEMP表空间
  4. 32岁的程序员被裁,java宿舍管理系统源码jsp
  5. latex 中手写l的输入方法
  6. 微信表情图像代表什么意思_微信里的表情每个头像代表什么意思
  7. 三元锂电池和磷酸铁锂电池的区别
  8. 9.绘制统计图形——饼图
  9. Android 高德地图(带有定位和点击显示经度纬度)
  10. 可信认证之九阴真经一