E-mail Basics

The e-mail message format is defined in RFC 2822. This document specifies various headers that may be (or, in some cases, must be) present in message. Most of them is generated directly by the mail engine of .NET Framework and we don't need to worry about them.

Originator headers

When sending messages from application, certain headers -- specifying message sender properties -- may be very important, as these messages are usually sent from unattended mailboxes.

The 'From' header

This header specifies name and address of originator of the message. This is the name usually displayed by default in mail program. Unless specified otherwise (by end user or the Reply-To header), replies to the message are sent to this address.

The 'Sender' header

This header is used when the message is not sent directly by the originator. The RFC 2822 uses example of e-mail message sent by secretary on behalf of the original author. In context of web application, we see more often the web server sending message on behalf of a person.

When this header is present, mail client typically displays the 'From' header in short view and in detail views displays the originator in form 'SENDER on behalf of FROM'. This is important, because it clearly implies that the message was sent in the name of someone, but not by the person directly.

The 'Reply-To' header

This header specifies default address to reply. This is used in cases when it's good idea to reply to someone else than person specified in 'From' field.

Recommended settings

The following are common scenarios when proper configuration of originator headers may be beneficial.

Simple notification by web server

Message, where no user action is expected and required, such as notification about that new item was added etc.

Set 'From' to system address of web server, ie. www-daemon@example.org and do not send any other originator headers. The address is usually unattended, all mail delivered is automatically deleted. It's always good idea to notify user that it makes no good replying to such a message and
provide alternative ways to contact the message sender.

Notification where reply is possible or expected

This kind of message may be for example order confirmation, where the user might want to contact customer service. Here are two possible approaches:
  1. Set 'From' address to customer-service@example.org and 'Sender' address to www-daemon@example.org.
  2. Set 'From' address to www-daemon@example.org and 'Reply-To' address to customer-service@example.org.

Notifications on behalf of third person

Sometimes we need to send notification on behalf of third person. For example customer sends question over web contact form. We have same optional as in the previous case. However, the second approach is usually better, since in this case we don't know if the e-mail address entered is functional and genuine.

Last edited Jun 3, 2013 at 1:50 PM by altair, version 2

Comments

No comments yet.