通过电子邮件发送来自 Raspberry Pi 的短信失败

通过电子邮件发送来自 Raspberry Pi 的短信失败

我正在我的树莓派上使用 mailx 尝试发送短信更新以进行事件监控。

  • 我的电话号码:9876543210
  • 我的手机的电子邮件到文本网关地址:[电子邮件保护]

我可以

  1. 从我的树莓派发送电子邮件到各个电子邮件地址。并且它顺利发送并成功送达。mail -r [email protected] -s "My Subject" [email protected] < body.txt

  2. 使用 mailx 从各种电子邮件地址(不在 RPi 上)发送电子邮件到上述电话电子邮件地址,并将其作为短信发送。

然而,发送电子邮件至[电子邮件保护]从 Raspberry Pi 使用 mailx 发送的电子邮件似乎消失了,再也没有收到过(没有错误,没有无法送达的消息,什么都没有)。有人知道是什么原因导致这种情况发生的吗?与 pi 上邮件服务器的基本部署有关吗?

编辑

根据@kobaltz的建议,我改用了sendmail。这导致挂起,然后出现错误,提示我缺少完全限定域名(FQDN)。然后我使用了本网站向 RPi 添加域名的说明。换句话说:

I have set the FQDN in  /etc/hostname: my-host-name.my-domain.com

and /etc/hosts:

127.0.0.1 localhost.localdomain localhost
192.168.0.5 my-host-name.my-domain.com my-host-name

Then add to /etc/mail/sendmail.cf:
MASQUERADE_AS(`my-domain.com')
MASQUERADE_DOMAIN(`my-host-name.my-domain.com')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')

I put this in /etc/mail/sendmail.cf, BEFORE the MAILER() lines, ran sendmailconfig, answered Yes to the questions about using the existing files, and restarted sendmail. Emails now have the proper domain name.

然而,现在我陷入了以下错误:

354 Enter mail, end with "." on a line by itself
>>> .
050 <[email protected]>... Connecting to mxx.cingularme.com. via esmtp...
050 421 Service not available
050 >>> QUIT
050 <[email protected]>... Deferred: 421 Service not available
250 2.0.0 q9U3ZESt021150 Message accepted for delivery
[email protected]... Sent (q9U3ZESt021150 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT

相关内容