Out of office replies are sent to 'from' address, 'not reply-to'
I am sending emails to clients in three different locations, using a common email address. Any errors/ out of office replies should go to local offices for them to deal with. So I use:
from: email@example.com reply-to: firstname.lastname@example.org
from: email@example.com reply-to: firstname.lastname@example.org
from: email@example.com reply-to: firstname.lastname@example.org
This seems to work well for email fails (wrong adddress, etc.) but Out of Office replies from Exchange always go to the sender address, email@example.com. I need them to go to the local office, reply-to address.
Any idea how I can solve this? I am sending the email from c#, using the standard MailMessage:
MailMessage mail = new mail.Subject = mailDetail["subject"].ToString(); mail.Body = mailDetail["body"].ToString(); // From mail.From = new MailAddress(ConfigManager.GetSetting("MailSender")); // Reply to (boucebacks / out of office etc) mail.ReplyTo = new MailAddress(mailDetail["reply_to"].ToString()); mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
Thanks for any help,
It's up to anyone/thing that responds to the mail to choose which property is most appropriate to use. The reply-to property should of course be used if it's a real reply, but an error message might not be seen as a reply, so the from property may be used for that in some cases. As you see, you will get different results depending on who/what is answering, and why.
You can use the Sender property to specify the actual sender as an addition to the from property. If it's handled properly, that is where the error messages should go if the reply-to property isn't used.
It's an RFC/Standard. http://tools.ietf.org/html/rfc3834
Where to send automatic responses (and where not to send them)
In general, automatic responses SHOULD be sent to the Return-Path field if generated after delivery. If the response is generated prior to delivery, the response SHOULD be sent to the reverse-path from the SMTP MAIL FROM command, or (in a non-SMTP system) to the envelope return address which serves as the destination for non- delivery reports.
If the response is to be generated after delivery, and there is no Return-Path field in the subject message, there is an implementation or configuration error in the SMTP server that delivered the message or gatewayed the message outside of SMTP. A Personal or Group responder SHOULD NOT deliver a response to any address other than that in the Return-Path field, even if the Return-Path field is missing. It is better to fix the problem with the mail delivery system than to rely on heuristics to guess the appropriate destination of the response. Such heuristics have been known to cause problems in the past.
A Service Responder MAY deliver the response to the address(es) from the >From field, or to another address from the request payload, provided this behavior is precisely defined in the specification for that service. Services responders SHOULD NOT use the Reply-To field for this purpose.
The Reply-To field SHOULD NOT be used as the destination for automatic responses from Personal or Group Responders. In general, this field is set by a human sender based on his/her anticipation of
Moore Standards Track [Page 12]
RFC 3834 Automatic E-Mail Responses August 2004
how human recipients will respond to the specific content of that message. For instance, a human sender may use Reply-To to request that replies be sent to an entire mailing list. Even for replies from humans, there are cases where it is not appropriate to respond to the Reply-To address, especially if the sender has asked that replies be sent to a group and/or mailing list. Since a Personal or Group Responder operates on behalf of a human recipient, it is safer to assume that any Reply-To field present in the message was set by a human sender on the assumption that any reply would come from a human who had some understanding of the roles of the sender and other recipients. An automatic responder lacks the information necessary to understand those roles. Sending automatic responses to Reply-To addresses can thus result in a large number of people receiving a useless or unwanted message; it can also contribute to mail loops.
Use of the From field as the destination for automatic responses has some of the same problems as use of Reply-To. In particular, the From field may list multiple addresses, while automatic responses should only be sent to a single address. In general, the From and Reply-To addresses are used in a variety of ways according to differing circumstances, and for this reason Personal or Group Responders cannot reliably assume that an address in the From or Reply-To field is an appropriate destination for the response. For these reasons the From field SHOULD NOT be used as a destination for automatic responses.
Similarly, the Sender field SHOULD NOT be used as the destination for automatic responses. This field is intended only to identify the person or entity that sent the message, and is not required to contain an address that is valid for replies.
The Return-Path address is really the only one from the message header that can be expected, as a matter of protocol, to be suitable for automatic responses that were not anticipated by the sender.