sendmail 中继时为空

sendmail 中继时为空

ec2-user向未知用户发送以登录身份的邮件时:

echo "Subject: test" | /usr/lib/sendmail -v abc

重定向到 ec2-user 的别名时为空白From:<>,这导致外部服务器拒绝邮件。即使设置也-f "ec2-user@internal"无法解决问题。

在我的里面/etc/aliases我有

root:     webmaster@external
ec2-user: webmaster@external

详细输出显示以下内容:

abc... Connecting to [127.0.0.1] via relay...
220 internal ESMTP Sendmail 8.14.4/8.14.4; Thu, 24 Mar 2016 16:42:37 GMT
>>> EHLO internal
250-internal Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<ec2-user@internal> SIZE=14
250 2.1.0 <ec2-user@internal>... Sender ok
>>> RCPT To:<abc@internal>
>>> DATA
550 5.1.1 <abc@internal>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
ec2-user... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1038
250 2.1.0 <>... Sender ok
>>> RCPT To:<ec2-user@internal>
>>> DATA
250 2.1.5 <ec2-user@internal>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 u2OGgbZL022963 Message accepted for delivery
ec2-user... Sent (u2OGgbZL022963 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 internal closing connection

当我向已知用户(例如ec2-user或 )发送邮件时root,该邮件会被收到。

以这种方式中继时,我该如何配置sendmail来设置地址?From

答案1

好的 - 这实际上与退回策略有关

5.2.9 Command Syntax: RFC-821 Section 4.1.2 

The syntax shown in RFC-821 for the MAIL FROM: command omits the case of an empty path: "MAIL 
FROM: <>" (see RFC-821 Page 15). An empty reverse path MUST be supported. 

5.3.3 Reliable Mail Receipt 
....... 
If there is a delivery failure after acceptance of a message, the receiver-SMTP MUST formulate 
and mail a notification message. This notification MUST be sent using a null ("<>") reverse 
path in the envelope; see Section 3.6 of RFC-821. The recipient of this notification SHOULD be 
the address from the envelope return path (or the Return-Path: line). However, if this address 
is null ("<>"), the receiver-SMTP MUST NOT send a notification. If the address is an explicit 
source route, it SHOULD be stripped down to its final hop.

维基百科上也有

Bounce messages in SMTP are sent with the envelope sender address <>, known as the null sender address.

https://en.wikipedia.org/wiki/Bounce_message

相关内容