要点"/>
linux 通过shell 发送QQ邮件技术要点
需求
每周一需要进行上周网站访问情况统计, 然后用python脚本处理数据, 然后发送邮件到统计情况到指定邮箱
考虑到这种工作的重复性以及工作的定时性, 准备让linux自动化帮我做这些工作,果然只有想偷懒才会推动社会进步, 推动科技发达
1. 机器环境
#腾讯云
OS: centos8
2.配置/etc/mail.rc文件 新增如下参数
set from=xxxxxxx@qq
set smtp=smtp.qq
set smtp-auth-user=xxxxxx@qq
#注意这里是授权码 而不是qq登录密码 自己去邮箱里面获取
set smtp-auth-password=xxxxxxx
set smtp-auth=login
set smtp-use-starttls
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/
3.然后测试发送邮件
echo hello word | mail -v -s " title" xxxxxxx @qq
如果输出一些文字,最后几行类似于
Resolving host smtp.qq . . . done.
Connecting to 183.3.225.42:smtp . . . connected.
220 xxxxxxxxx.qq XMail Esmtp QQ Mail Server.
>>> EHLO VM-8-12-centos
250-xxxxxxxx.qq
250-PIPELINING
250-SIZE 73400320
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
250-MAILCOMPRESS
250 8BITMIME
>>> STARTTLS
220 Ready to start TLS from 119.29.200.80 to newxmesmtplogicsvrszc5.qq.
Error in certificate: Peer's certificate issuer has been marked as not trusted by the.
Comparing DNS name: "*.mail.qq"
Comparing DNS name: "993.dav.qq"
Comparing DNS name: "993.eas.qq"
Comparing DNS name: "993.imap.qq"
Comparing DNS name: "993.pop.qq"
Comparing DNS name: "993.smtp.qq"
Comparing DNS name: "imap.qq"
Comparing DNS name: "mx1.qq"
Comparing DNS name: "mx2.qq"
Comparing DNS name: "mx3.qq"
Comparing DNS name: "pop.qq"
Comparing DNS name: "smtp.qq"
SSL parameters: cipher=AES-128-GCM, keysize=128, secretkeysize=128,
issuer=CN=GlobalSign Organization Validation CA - SHA256 - G2,O=GlobalSign nv-sa,C=BE
subject=CN=*.mail.qq,O=Shenzhen Tencent Computer Systems Company Limited,L=shenzhen,ST=guangdong,C=CN
>>> EHLO VM-8-12-centos
250-newxmesmtplogicsvrszc5.qq
250-PIPELINING
250-SIZE 73400320
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
250-MAILCOMPRESS
250 8BITMIME
>>> AUTH LOGIN
334 xxxxxxxxxxxxxx
>>> xxxxxxxxxxxxxxx==
334 xxxxxxxxxxxxx
>>> xxxxxxxxxxxxxxx==
235 Authentication successful
>>> MAIL FROM:<xxxxxxxx@qq>
250 OK.
>>> RCPT TO:<xxxxxxxx@qq>
250 OK
>>> DATA
354 End data with <CR><LF>.<CR><LF>.
>>> .
250 OK: queued as.
>>> QUIT
221 Bye.
那么恭喜你,你就成功了。 你可以去邮箱里面检查是否收到邮件了。
更多推荐
linux 通过shell 发送QQ邮件技术要点
发布评论