sendmail中继时为空

发送以ec2-user身份login到未知用户的邮件时:

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

当redirect到导致外部服务器拒绝邮件的ec2用户的别名时, 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-userroot ,邮件就会被接收。

如何configurationsendmail以这种方式进行中继时设置From地址?

好的 – 它实际上是与反弹政策

 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. 

也在WIKI上

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

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