无法使用 mailx 从 AWS EC2 实例发送电子邮件

Unable to send email from AWS EC2 instance using mailx

我想通过电子邮件向自己发送存储在 AWS EC2 实例上的错误日志,以帮助我解决在尝试远程桌面到计算机时遇到的问题。这是一次性的事情 - 我不会使用 EC2 从网络应用程序等定期发送电子邮件。阅读 this link 它说:

Q: Are there any limitations in sending email from EC2 instances?

Yes. In order to maintain the quality of EC2 addresses for sending email, we enforce default limits on the amount of email that can be sent from EC2 accounts. If you wish to send larger amounts of email from EC2, you can apply to have these limits removed from your account by filling out this form.

所以这意味着我应该可以毫无问题地发送几封电子邮件。我尝试通过电子邮件向自己发送错误日志,如下所示:

cat log.txt | sudo mailx me@yahoo.com

它没有给出任何错误,但文件从未被传送。我认为它永远不会发送出去。我该如何解决这个问题?我不熟悉unix。仔细阅读 mailq 向我展示了这一点:

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
6295B488F5    37616 Wed Apr  1 02:10:30  root@ip-xxx-xx-x-xx.us-west-2.compute.internal   a@yahoo.com

除此之外我不知道还能做什么。

编辑:这很有趣。我确实收到了发送到我的收件箱的消息,但只是在大约 2 天后。

如果您可以通过 ssh 访问该框,只需使用 scp 即可获取该文件。例如,来自 OSX 命令行:

scp -i your.pem ubuntu@ec2-1-2-3-4.compute-1.amazonaws.com:your_file your_file

这是为了"ubuntu"登录,"your_file"在主目录中,在本地保存为同名。我想也有 GUI 版本,例如,我曾经在 Windows.

上使用 Putty