neo*_*o33 3 command-line ubuntu email mail-transport-agent mail-command
我在家里的电脑上工作我想给我发一封电子邮件,我试过:
uuencode all.sh all.sh | mail mymail@gmail.com
Run Code Online (Sandbox Code Playgroud)
但问题是我的电子邮件没有收到任何内容,我只是收到以下错误:
mail: cannot send message: Process exited with a non-zero status
Run Code Online (Sandbox Code Playgroud)
事实是,我在工作中使用了相同的命令并且它运行良好,我想感谢任何解决此问题的建议。我不确定在我的个人计算机中使用该命令行之前是否必须设置任何文件。我也尝试安装 mutt:
mutt myemail@gmail.com < all.sh
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
sendmail: Cannot open mail:25
Error sending message, child exited 1 ().
Could not send the message.
Run Code Online (Sandbox Code Playgroud)
基本mail命令只是邮件阅读器和编辑器,它不知道如何通过网络(使用SMTP协议)与服务器通信。会说话的 SMTP 是MTA(邮件传输代理)的工作。Ubuntu 上的默认 MTA 是 Postfix。要配置 Postfix,请运行
sudo dpkg-reconfigure postfix
Run Code Online (Sandbox Code Playgroud)
如果您只想发送邮件而不想接收任何邮件,请选择“卫星系统”。
请注意,除非你有一台永久连接的机器,有合适的 DNS 条目,最好有静态 IP 地址,否则你不能直接接收邮件:你必须使用外部服务器,然后使用诸如IMAP。
Ubuntu 包含多个版本的mail命令。该传家宝- mailx的版本不知道如何说话SMTP。您在~/.mailrc. 配置可能如下所示:
set smtp=smtp.example.com
set smtp-use-starttls
set smtp-auth-user=neo33
set smtp-auth-password=swordfish
Run Code Online (Sandbox Code Playgroud)