我正在尝试从 MacBook 快速向自己发送一些内容,但由于发件人字段中的域名不合格,我的服务器拒绝 SMTP 连接,从而出现问题。
我尝试过使用EMAIL
环境变量杂种狗(1)/var/log/mail.log
,但在我的 MacBook 上我仍然遇到同样的错误:
Aug 1 13:32:52 MacBook-Air-01234567890.local postfix/smtp[91675]: AEA7EDD2D11: to=<[email protected]>, relay=a.mx.---.--[88.198.--.--]:25, delay=7.8, delays=0.78/0.01/6.8/0.17, dsn=5.1.8, status=bounced (host a.mx.---.--[88.198.--.--] said: 553 5.1.8 <[email protected]>... Domain of sender address [email protected] does not exist (in reply to MAIL FROM command))
答案1
ports/mail/mutt
解决方案:
这是因为mutt
没有根据EMAIL
环境变量更改 SMTP 信封,因此必须使用以下内容来代替:tcsh句法:
env EMAIL=`whoami`@`hostname`.example.org \
mutt -s "`history 1`" -e 'set envelope_from' [email protected]
基本上,您不仅需要在环境变量中指定您的电子邮件EMAIL
,还需要传递-e 'set envelope_from'
给mutt
,默认为no
,根据http://www.mutt.org/doc/manual/#use-envelope-from。
mail(1)
解决方案:
另一种选择是利用事实mail(1)
命令让我们你通过任何sendmail-flags
过去的的规格to-addr
:
mail [-EIinv] [-a file] [-b bcc-addr] [-c cc-addr] [-r rcfile]
[-s subject] to-addr ... [- sendmail-flags]
这似乎-f
仅在示例中明确记录NetBSD 的邮件手册页(1),不在OpenBSD 的,FreeBSD 的、OS X 或 macOS 的:
Sending mail
To send a message to one or more people, mail can be invoked with argu-
ments which are the names of people to whom the mail will be sent. You
are then expected to type in your message, followed by a `control-D' at
the beginning of a line.
Any flags following the list of recipients, will be passed, together with
their arguments, directly to sendmail(1). For example to change your
From address to [email protected] you can specify:
mail recipient -f [email protected]
例如,以下内容的工作方式与mutt
上面的示例相同;在 OS X 上测试成功:
mail -s "`history 1`" [email protected] -f `whoami`@`hostname`.example.org
注意顺序确实很重要;并且不会起作用;请参阅上面的详细信息!mail -f [email protected] -s subject [email protected]