我正在尝试从终端发送电子邮件(bash)。我做了:
echo "text" | mail -vs "subject" "myself@address.com"
详细标志返回
Mail Delivery Status Report will be mailed to <Me>
但我的收件箱中既未收到Mail Delivery Status Report
也未收到电子邮件。 Mail Delivery Status Report
似乎保存在文件/var/mail/Me
中。这是我收到的最后一份报告:
--EAB82C90F6D.1445818910/Remis-MacBook-Pro.local
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; Remis-MacBook-Pro.local
X-Postfix-Queue-ID: EAB82C90F6D
X-Postfix-Sender: rfc822; remi@Remis-MacBook-Pro.local
Arrival-Date: Sun, 25 Oct 2015 17:21:49 -0700 (PDT)
Final-Recipient: rfc822; myself@address.com
Action: delayed
Status: 4.4.1
Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to
alt2.gmail-smtp-in.l.google.com[173.194.219.26]:25: Connection refused
--EAB82C90F6D.1445818910/Remis-MacBook-Pro.local
Content-Description: Message Headers
Content-Type: text/rfc822-headers
Return-Path: <remi@Remis-MacBook-Pro.local>
Received: by Remis-MacBook-Pro.local (Postfix, from userid 501)
id EAB82C90F6D; Sun, 25 Oct 2015 17:21:49 -0700 (PDT)
To: myself@address.com
Message-Id: <20151026002149.EAB82C90F6D@Remis-MacBook-Pro.local>
Date: Sun, 25 Oct 2015 17:21:49 -0700 (PDT)
From: remi@Remis-MacBook-Pro.local (Remi)
--EAB82C90F6D.1445818910/Remis-MacBook-Pro.local--
出了什么问题?
我使用的是Mac OSX El Capitano版本10.11
答案 0 :(得分:0)
我添加了these instructions和these instructions,
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
smtp_sasl_mechanism_filter = plain
到/etc/postfix/main.cf
我还创建了/etc/postfix/sasl_passwd
并写了
[smtp.gmail.com]:587 username@gmail.com:password
在里面。然后我跑了
sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo launchctl stop org.postfix.master
sudo launchctl start org.postfix.master
并更改了我的Google帐户设置以允许“安全性较低的应用”(请参阅说明here)。它有效!