Pipes | Streams  «Prev 

Sending email in Perl

Internet mail headers

Question: How were Internet mail headers used when the World Wide Web first emerged?
When the World Wide Web first emerged, Internet mail headers were used to send messages containing HTML documents, images, and other multimedia content. These messages were sent using the Simple Mail Transfer Protocol (SMTP) and were typically viewed using a web browser. The headers contained information such as the sender's email address, the recipient's email address, the subject of the message, and the date and time the message was sent. This allowed for basic communication and information sharing on the early World Wide Web.
An Internet email message is a very strictly defined item. It begins with a set of standardized header lines, followed by a blank line, followed by the body of the message. Technically, the only acceptable line endings are carriage-return/line-feed pairs ("\x0d\x0a" in Perl). But, in practice, whatever line endings are commonly used on your system will likely be translated into Internet-standard line endings by your mail program. Many of the required headers are added by the mail transfer program that you are calling. The important ones that you may want to define are listed here:
The email header is a code snippet in an HTML email, that contains information about the sender, recipient, email’s route to get to the inbox and various authentication details. The email header always precedes the email body.


To:        The email address of the recipient
From:      The email address of the sender
Reply-To:  The email address that you would like replies to go to
Cc:        The email addresses of any other recipients(carbon copy)
Bcc:       Email addresses for recipients that you would like copies 
           sent to, without having them listed in the message headers 
           (blind carbon copy)
Subject:   The subject of the message
X-anything:  Optional headers that you define yourself

Any headers that start with "X-" are considered extension headers, and you may define them yourself for your own purposes. For example, you may want a header that instructs a receiving program to create a file or simply an extra header that you can use for filters in your mail-reading program.