Linux 中相当于 PowerShell Send-MailMessage

Linux 中相当于 PowerShell Send-MailMessage

如何从 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]

相关内容