我将 sSMTP 更新到 2.61 版,现在当我尝试使用它时,我收到以下错误:
ssmtp: Cannot open smtp.gmail.com:587
Run Code Online (Sandbox Code Playgroud)
我可以通过 telnet 连接到他们的地址,但 sSMTP 似乎被绊倒了,我不确定更新后发生了什么变化。
这里是 ssmtp.conf
root=XXXXX@gmail.com
mailhub=smtp.gmail.com:587
RewriteDomain=gmail.com
Hostname=localhost
UseTLS=YES
UseSTARTTLS=Yes
AuthUser=XXXXX
AuthPass=XXXXX
FromLineOverride=yes
Run Code Online (Sandbox Code Playgroud)
通过 telnet 连接时的输出:
[root@soupcan sbin]# telnet smtp.gmail.com 587
Trying 74.125.142.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 mx.google.com ESMTP l7sm7330049igx.2 - gsmtp
quit
221 2.0.0 closing connection l7sm7330049igx.2 - gsmtp
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud)
当我尝试使用时的输出 sSMTP
[root@soupcan sbin]# /usr/sbin/ssmtp -v XXXXX@gmail.com < /home/user/Documents/Scripts/msg.txt
[<-] 220 mx.google.com ESMTP f5sm7367852igc.4 - gsmtp
[->] EHLO localhost …
Run Code Online (Sandbox Code Playgroud) 我的要求是:
我尝试过“通过 gmail 发送单行消息的最简单答案是使用 ssmtp”,以及几种变体,并不断得到:
笔记本电脑 sSMTP[19226]:授权失败(535 5.7.8 https://support.google.com/mail/?p=BadCredentials d13sm3920147qkj.27 - gsmtp)
谷歌设置:
对于我尝试的每个ssmtp.conf
设置,我之前已经完成了DisplayUnlockCaptcha :
$echo "Testing...1...2...3" | ssmtp myusername@gmail.com
Run Code Online (Sandbox Code Playgroud)
仅查看所述线程/etc/ssmtp/ssmtp.conf
,对于应如何设置尚未达成共识:
mailhub=smtp.gmail.com:587
VS 465UseTLS=YES
与UseSTARTTLS=Yes
(或两者?)hostname=localhost
与默认放置在那里的任何内容(在我的例子中,laptop
)有人可以提出解决这个问题的建议,并可能完整粘贴一个工作conf文件吗?
2017 年的一个帖子中有一个说法:
您无法使用普通密码使用外部应用程序,您必须访问https://security.google.com/settings/security/apppasswords
是这样吗?(我做不到)
还有哪些替代方案?
附:
我ssmtp
用于发送电子邮件(设置如下)
现在,当我运行cron
命令或at
命令时,邮件被发送到
michel@mypi
Run Code Online (Sandbox Code Playgroud)
这是 username @ machinename
现在当然这不是一个有效的电子邮件地址,所以我在我的 gmail 中收到错误消息: can't send email to michel@mypi
我应该如何以及在哪里说给用户“michel”的电子邮件应该转到特定的电子邮件地址?
ssmtp 的设置:
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000 # Make this empty to disable rewriting.
root=MYNAME@gmail.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:465
# Where will the …
Run Code Online (Sandbox Code Playgroud) 建立在上一篇文章的基础上,其中要求让 cron 作业通过单个命令行发送状态消息,如下所示:
关于如何使用单行发送附件文件的问题出现了。
设想:
cron 作业生成输出文件,如下所示:
cd /home/pi/python
gnuplot plt12
Run Code Online (Sandbox Code Playgroud)
程序文件 plt12 包括以下两行:
set output "pl12.png"
set terminal png font "arial,11"
Run Code Online (Sandbox Code Playgroud)
这是在 Rpi3B 系统上完成的,该系统通过 USB 连接到用于进行数据记录的 ADC 的 Nano。
那么,问题是,使用单个命令行通过 gmail 发送该绘图文件图像的最简单方法是什么?
我有以下 ssmtp.conf 文件:
root=test@gmail.com
mailhub=smtp.gmail.com:587
hostname=ed424cef9b52
UseTLS=Yes
UseStartTTLS=Yes
AuthMethod=LOGIN
AuthUser=test
AuthPass=test
FromLineOverride=yes
TLS_CA_File=/etc/ssl/certs/ca-certificates.crt
Run Code Online (Sandbox Code Playgroud)
我可以连接到 587 gmail 端口:
telnet smtp.gmail.com 587
Trying 64.233.186.109...
Connected to gmail-smtp-msa.l.google.com.
Run Code Online (Sandbox Code Playgroud)
但是当我尝试发送邮件时:
/usr/sbin/ssmtp -v test@gmail.com < qq
ssmtp: Cannot open smtp.gmail.com:587
echo test | mailx -s "testing ssmtp setup" test@gmail.com
send-mail: Cannot open smtp.gmail.com:587
Can't send mail: sendmail process failed with error code 1
Run Code Online (Sandbox Code Playgroud)