![Linux 中相当于 PowerShell Send-MailMessage](https://linux22.com/image/1413187/Linux%20%E4%B8%AD%E7%9B%B8%E5%BD%93%E4%BA%8E%20PowerShell%20Send-MailMessage.png)
如何从 Linux 命令行通过我们的内部 SMTP 服务器发送电子邮件?
就像是:
sendmessage -server smtp.mycompany.net -subject "Alert aaagh!" -body "The boron control rods have melted, again!" -to [email protected]
也许我需要安装一个 yum 包?#linuxnoob
答案1
有点晚了,但我在寻找完全一样的东西。Send-MailMessage
无需额外配置的直接替代品。我发现最好的替代方案是msmtp
可通过yum
和获得的apt
。
echo -e "Subject: Alert aagh!\n\nThe boron control rods have melted, again" | msmtp --auth=off --host=smtp.mycompany.net --port=25 -t [email protected]
答案2
尝试mailx
:
mailx -s "test email to nate" [email protected]
[Type your message here]
[Press CTRL-D to end the body]