⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch09_03.htm

📁 用perl编写CGI的好书。本书从解释CGI和底层HTTP协议如何工作开始
💻 HTM
字号:
<?label 9.3. Structure of Internet Email?><html><head><title>Structure of Internet Email (CGI Programming with Perl)</title><link href="../style/style1.css" type="text/css" rel="stylesheet" /><meta name="DC.Creator" content="Scott Guelich, Gunther Birznieks and Shishir Gundavaram" /><meta scheme="MIME" content="text/xml" name="DC.Format" /><meta content="en-US" name="DC.Language" /><meta content="O'Reilly & Associates, Inc." name="DC.Publisher" /><meta scheme="ISBN" name="DC.Source" content="1565924193L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="CGI Programming with Perl" /><meta content="Text.Monograph" name="DC.Type" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" alt="Book Home" usemap="#banner-map" border="0" /><map name="banner-map"><area alt="CGI Programming with Perl" href="index.htm" coords="0,0,466,65" shape="rect" /><area alt="Search this book" href="jobjects/fsearch.htm" coords="467,0,514,18" shape="rect" /></map><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="ch09_02.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm">CGI Programming with Perl</a></td><td width="172" valign="top" align="right"><a href="ch09_04.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><hr align="left" width="515" /><h2 class="sect1">9.3. Structure of Internet Email</h2><p>Email <a name="INDEX-1852" /> <a name="INDEX-1,853" /> <a name="INDEX-1,854" /> <a name="INDEX-1,855" />messages are documents containing<a name="INDEX-1856" />headers and a<a name="INDEX-1857" />body separated by a blank line. Eachheader contains a field name followed by a colon, some space, and avalue. Does this sound familiar? In a basic sense, Internet mailmessages are similar in structure to <a name="INDEX-1858" />HTTP messages. There arealso a number of differences of course: there is no request line orstatus line; email messages are text documents (binary attachmentsmust be encoded as text before being sent); and most of the fieldnames are different. But if you recall the basic header and bodyformat from our earlier HTTP discussion, that will help youunderstand how to create email messages.</p><p>Some<a name="INDEX-1859" /><a name="INDEX-1860" />header fields hold emailaddresses. These can support the full syntax of email addresses thatwe saw earlier, including the recipient's name in addition tothe email address itself, like so:</p><blockquote><pre class="code">Mary Smith &lt;mary@somewhere.com&gt;</pre></blockquote><p>The shorter <em class="emphasis">mary@somewhere.com</em> is also acceptable.</p><p>There are only a few header fields you need to include in emailmessages: who it is to, who it is from, and what it is about. Thefirst of these fields is actually any of three fields:<em class="emphasis">To</em><a name="INDEX-1861" /> <a name="INDEX-1,862" />,<em class="emphasis">Cc</em>, and <em class="emphasis">Bcc</em>.<em class="emphasis">To</em> and <em class="emphasis">Cc</em> (which stands for<em class="emphasis">carbon-copy</em>) contain the email addresses of anyof the recipients of the message. The<em class="emphasis">Bcc</em><a name="INDEX-1863" /> field (which stands for<em class="emphasis">blind carbon-copy</em>) does likewise but is deletedfrom the message before it is sent. The<em class="emphasis">From</em><a name="INDEX-1864" /> <a name="INDEX-1,865" /> field contains the email addressof the person the message is from. If you want replies to be directedelsewhere, you may also specify that email address in the<em class="emphasis">Reply-To</em><a name="INDEX-1866" /> field. Finally, the<em class="emphasis">Subject</em><a name="INDEX-1867" /> field contains a summary of the emailaddress.</p><p>So far, this is all pretty basic; all of us have received emailbefore. There is, however, a subtle distinction that is important tonote. Internet email is in some ways similar to real paper mail: ithas a message, which can contain anything, inside an envelope, andthe envelope carries the <a name="INDEX-1868" />routing information. On formal letters,you often add the recipient's address information to the top ofthe message; however, it's quite possible to put a messageaddressed this way in an envelope that is actually addressed androuted to someone else. The same thing is possible with Internetemail. The <em class="emphasis">To</em>, <em class="emphasis">Cc</em>,<em class="emphasis">Bcc</em>, and <em class="emphasis">From</em> fields areactually part of the message. They do not determine any of therouting information and do not need to match who the message truly isto or from. You have probably received <em class="firstterm">spam</em>that, according to the <em class="emphasis">To</em> field, appeared to beaddressed to someone other than you; likewise, the recipient listedin the <em class="emphasis">From</em> field on most spam is not the truesender. However, for our purposes, we typically do want the addressinformation and these fields to line up. We'll explore thismore when we review each of the mailers below.</p><p>There are many other important fields that appear in the headers ofemail addresses, but mailers take care of adding these for you, so wewon't include them in our discussion.</p><hr align="left" width="515" /><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="ch09_02.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td width="172" valign="top" align="right"><a href="ch09_04.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td width="172" valign="top" align="left">9.2. Email Addresses</td><td width="171" valign="top" align="center"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td width="172" valign="top" align="right">9.4. sendmail</td></tr></table></div><hr align="left" width="515" /><img src="../gifs/navbar.gif" alt="Library Navigation Links" usemap="#library-map" border="0" /><p><font size="-1"><a href="copyrght.htm">Copyright &copy; 2001</a> O'Reilly &amp; Associates. All rights reserved.</font></p><map name="library-map"><area href="../index.htm" coords="1,1,83,102" shape="rect" /><area href="../lnut/index.htm" coords="81,0,152,95" shape="rect" /><area href="../run/index.htm" coords="172,2,252,105" shape="rect" /><area href="../apache/index.htm" coords="238,2,334,95" shape="rect" /><area href="../sql/index.htm" coords="336,0,412,104" shape="rect" /><area href="../dbi/index.htm" coords="415,0,507,101" shape="rect" /><area href="../cgi/index.htm" coords="511,0,601,99" shape="rect" /></map></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -