Emailing With PHP
What is Email? Email, short for electronic mail and often abbreviated to email, email or simply mail, is a store and forward method of composing, sending, receiving and storing messages over electronic communication systems. History of Email 1. MIT first demonstrated the Compatible TimeSharing System (CTSS) in 1961.It allowed multiple users to log into the IBM 7094 from remote dialup terminals, and to store files online on disk. This new ability encouraged users to share information in new ways. Email started in 1965 as a way for multiple users of a timesharing mainframe computer to communicate. Note : TimeSharing refers to sharing a computing resource among many users by multitasking. 2. In the early 1970's, Ray Tomlinson was working on a small team developing the TENEX operating system,with local email programs called SNDMSG and READMAIL. 3.In late 1971, Tomlinson developed the first ARPANET email application when he updated SNDMSG by adding a program called CPYNET capable of copying files over the network, and informed his colleagues by sending them an email using the new program with instructions on how to use it. 4. Network capable email was developed for the ARPANET (The ARPANET (Advanced Research Projects Agency Network) developed by DARPA (Defense Advanced Research Projects Agency) of the United States Department of Defense, was the world's first operational packet switching network, and the predecessor of the global Internet) 5. SMTP (standard for email transmissions across the Internet) was published as RFC 821 in August 1982, also by Jonathan Postel 6.Allman developed sendmail program, which was distributed with BSD Unix, and has gone on to become the the most commonly used SMTP server on the Internet. Applications or Use 1.The Hotmail service was founded by Sabeer Bhatia and Jack Smith , and was one of the first webmail services on the Internet. It was commercially launched on July 4, 1996, American Independence Day. 2. It was sold at 1997 to Microsoft for a reported $400 million, and it joined the MSN group of services 3.Yahoo! Mail (Started at 1996) is a Webbased email (webmail) service from Yahoo!. It is the most used email on the Internet, serving over 260 million users.
4. Gmail, officially Google Mail is a free Webbased email (webmail), POP3[1] and IMAP[2] email service provided by Google. On April 1, 2004 the product began as an invitationonly beta release. On February 7, 2007 the beta version was opened to the general public. Technology Used In Email Technology Used In Email The format of Internet email messages is defined in RFC 2822 and a series of RFCs, RFC 2045 through RFC 2049, collectively called Multipurpose Internet Mail Extensions (MIME). Internet email messages consist of two major sections: * Header — Structured into fields such as summary, sender, receiver, and other information about the email * Body — The message itself as unstructured text; sometimes containing a signature block at the end The header is separated from the body by a blank line. Header The message header consists of fields, usually including at least the following: * From: The email address, and optionally the name of the sender * To: The email address[es], and optionally name[s] of the message's recipient[s] * Subject: A brief summary of the contents of the message * Date: The local time and date when the message was written Other common header fields include (see RFC 4021 or RFC 2076 for more): * Cc: carbon copy * Bcc: Blind Carbon Copy * Received: Tracking information generated by mail servers that have previously handled a message * ContentType: Information about how the message has to be displayed, usually a MIME type * ReplyTo: Address that should be used to reply to the sender. * References: MessageID of the message that this is a reply to, and the messageid of this message, etc. * InReplyTo: MessageID of the message that this is a reply to. * XFace: Small icon. Many email clients present "Bcc" (Blind carbon copy, recipients not visible in the "To" field) as a header field. Different protocols are used to deal with the "Bcc" field; at times the entire field is removed, whereas other times the field remains but the addresses therein are removed. Addresses added as "Bcc" are only added to the SMTP delivery list, and do not get included in the message data.
Body Content encoding * Email was originally designed for 7bit ASCII. Much email software is 8bit clean but must assume it will be communicating with 7bit servers and mail readers. Plain Text and HTML * Both plain text and HTML are used to convey email. Advantages of HTML include the ability to include inline links and images, set apart previous messages in block quotes, wrap naturally on any display, use emphasis such as underlines and italics, and change font styles. Example DeliveredTo:
[email protected] Received: by 10.140.203.16 with HTTP; Thu, 20 Mar 2008 00:52:52 0700 (PDT) MessageID:
Date: Thu, 20 Mar 2008 13:22:52 +0530 From: "xavier suresh" To: "Anthoni raj" Subject: asking iedas MIMEVersion: 1.0 dear friend happy newyear if you have any picture please send me today ClientServer Technology * Messages are exchanged between hosts using the Simple Mail Transfer Protocol with software programs called mail transport agents. Users can download their messages from servers with standard protocols such as the POP or IMAP protocols, or, as is more likely in a large corporate environment, with a proprietary protocol specific to Lotus Notes or Microsoft Exchange Servers. * Mail can be stored either on the client, on the server side, or in both places. Standard formats for mailboxes include Maildir and mbox. Several prominent email clients use their own proprietary format and require conversion software to transfer email between them. * When a message cannot be delivered, the recipient MTA must send a bounce message back to the sender, indicating the problem.
Filename extensions email clients save individual messages as separate files, or allow users to do so. Different applications save email files with different filename extensions. .eml This is the default email extension for Mozilla Thunderbird and Windows Mail. It is used by Microsoft Outlook Express. .emlx Used by Apple Mail. .msg Used by Microsoft Office Outlook. Sendmail Configuration in php.ini file # vim /opt/lampstack/php/etc/php.ini [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = [email protected] ; For Unix only. You may supply arguments as well (default: "sendmail t i"). sendmail_path = sendmain t i ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = Simple Example
Mail Function in PHP Syntax mail — Send mail Description bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) Parameters to Receiver, or receivers of the mail. The formatting of this string must comply with » RFC 2822. Some examples are: * [email protected] * [email protected], [email protected] * User <[email protected]> * User <[email protected]>, Another User subject Subject of the email to be sent. Caution This must not contain any newline characters, or the mail may not be sent properly. message Message to be sent Each line should be separated with a LF (\n). Lines should not be larger than 70 characters. additional_headers (optional) String to be inserted at the end of the email header. This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n). additional_parameters (optional) sending mail using the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the f sendmail option.