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

📄 634-636.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Using Electronic Mail</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--CHAPTER=33//-->

<!--PAGES=634-636//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="632-634.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="637-638.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading6"></A><FONT COLOR="#000077">Sending a Prepared Message</FONT></H4>

<P>You may want to use a text editor such as <TT>vi</TT> to compose a message to be sent by e-mail. If you use a text editor, you have the tools to do things such as format the text and check your spelling. It doesn&#146;t matter what program you use to create the text, as long as you end up with a text or ASCII file.</P>

<P>Suppose that the file you want to send is named report.txt and the recipient&#146;s address is top@kite.fish.com. There are essentially three ways to send the file, as outlined in the following list. In the following examples, the <TT>mail</TT> command uses the option <TT>-s</TT>, and the string that serves as the subject heading is surrounded by quotation marks:</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;<I>Use a pipe.</I> To send report.txt with the <TT>mail</TT> command, enter the following:

<!-- CODE SNIP //-->

<PRE>

  cat report.txt | mail -s&#148; Sales Report&#148; top@kite.fish.com

</PRE>

<!-- END CODE SNIP //-->

<DD><B>&#149;</B>&nbsp;&nbsp;<I>Redirect input.</I> To send report.txt with the <TT>mail</TT> command and the <TT>-s</TT> option, enter the following:

<!-- CODE SNIP //-->

<PRE>

<B>mail -s&#148; Sales Report&#148; top@kite.fish.com &lt; report.txt</B>

</PRE>

<!-- END CODE SNIP //-->

<DD><B>&#149;</B>&nbsp;&nbsp;<I>Use ~r to include a file in a message.</I> To use <TT>mail</TT> to send the file (by using the default <TT>Subject</TT> prompt), enter these commands:

<!-- CODE SNIP //-->

<PRE>

<B>mail top@kite.fish.com</B>

Subject: <B>Sales Report</B>

<B>~r report.txt</B>

<B>~.</B>

EOT

</PRE>

<!-- END CODE SNIP //-->

</DL>

<P>You see the system prompt after you complete any of these three methods; the result is the same in any case.

</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>In the third example, you use ~r to <TT>read</TT>, or include, the file report.txt in the e-mail message. This is an example of a <TT>tilde command</TT>. To use such commands, you precede a command with the tilde character (~) while you&#146;re reading or sending mail. You may find several other tilde commands useful; they&#146;re discussed at appropriate points throughout the chapter.<HR></FONT>

</BLOCKQUOTE>

<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077">Sending the Result of a Command or Program by E-Mail</FONT></H4>

<P>If you run a command or program that produces results to the screen (known as stdout), you can pipe that output to a <TT>mail</TT> command. Suppose that you have some information in a file called contrib.lst, use the <TT>sort</TT> command to sort the file, and then send the results to yourself (login name bkorn) and top (whom you met earlier in this chapter). To do all that, enter this command:</P>

<!-- CODE SNIP //-->

<PRE>

<B>sort contrib.lst | mail -s &#147;Sorted Contrib Info&#148; bkorn top@kite.fish.com</B>

</PRE>

<!-- END CODE SNIP //-->

<H3><A NAME="Heading8"></A><FONT COLOR="#000077">Reading Your Mail</FONT></H3>

<P>Most Linux systems notify you when you log in that you have e-mail. It&#146;s up to you to read and act on it. You can use <TT>mail</TT> or another e-mail program to read any mail you have. As you read your mail, the e-mail program marks each message as read. Depending on what commands you use and how you quit the e-mail program, the messages you&#146;ve read are kept either in your system mailbox, /var/spool/mail/$LOGNAME, or in your login directory in the file named mbox.</P>

<H4 ALIGN="LEFT"><A NAME="Heading9"></A><FONT COLOR="#000077">Using <I>mail</I> to Read Mail

</FONT></H4>

<P>To read your mail with <TT>mail</TT>, enter <TT><B>mail</B></TT>. If your login name is bkorn, you&#146;ll see a display similar to this (what you type is in bold):</P>

<!-- CODE //-->

<PRE>

<B>mail</B>

mail     Type ? for help.

&#147;/var/spool/mail/bkorn&#148;: 5 messages 2 new 1 unread

     1 sarah Wed Jan  8 09:17  15/363

     2 top@kite.fish.com Thu Jan  9 10:18  26/657   Meeting on Friday

U    3 fred_Fri Jan  10 08:09  32/900   New Orders

&gt; N  4 jones Fri Jan  10 13:22  35/1347  Draft Report

N    5 smith@somewhere.com Sat Jan  11 13:21  76/3103  Excerpt from book

?

</PRE>

<!-- END CODE //-->

<P>Here are some things to note about the display:

</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;The first line identifies the program and says to type a question mark for help.

<DD><B>&#149;</B>&nbsp;&nbsp;The second line indicates that <TT>mail</TT> is reading your system mailbox, /var/spool/mail/bkorn, and that you have five messages. Two have arrived since you last checked your mail, one appeared previously but you haven&#146;t yet read it, and two messages have already been read.

<DD><B>&#149;</B>&nbsp;&nbsp;The next five lines give information about your mail. Ignore the first few characters for now. Each line holds a message number, the address of the sender, the date the message was sent, the number of lines and characters in the message, and the subject (if one was given). Consider the following line:

<!-- CODE SNIP //-->

<PRE>

2 top@kite.fish.com  Thu Jan  9 10:18  26/657  Meeting on Friday

</PRE>

<!-- END CODE SNIP //-->

<BR>This line indicates that message number 2 is from top@kite.fish.com&#151;an address that indicates the message came to your machine from another network (mail from a local user is marked with just the user&#146;s login ID). The message was sent on Thursday, January 9, at 10:18; it consists of 26 lines and 657 characters. The subject is <I>Meeting on Friday</I>.

<DD><B>&#149;</B>&nbsp;&nbsp;A message line starting with <TT>N</TT> indicates new mail&#151;mail received since you last checked your e-mail. A message line starting with <TT>U</TT> indicates unread mail. A message line without <TT>N</TT> or <TT>U</TT> indicates mail you&#146;ve read and saved in your system mailbox.

<DD><B>&#149;</B>&nbsp;&nbsp;The greater-than character (<TT>&gt;</TT>) on a message line marks the current message&#151;the message you&#146;ll act on next.

<DD><B>&#149;</B>&nbsp;&nbsp;The question mark (<TT>?</TT>) on the last line is the command prompt from <TT>mail</TT>.

</DL>

<P><FONT SIZE="+1"><B>Reading the Current Message</B></FONT></P>

<P>The current message is the message marked by the greater-than character (<TT>&gt;</TT>). To read that message, just press &lt;Return&gt;. When you open it, you see something like the following:</P>

<!-- CODE //-->

<PRE>

Message 4:

From jones Fri, Jan 10 13:22 EST 1997

Received: by your.system.com

Date: Fri, 10 Jan 1997 13:22:01 -0500

From: Carol Jones &lt;jones&gt;

Return-Path: &lt;jones&gt;

To: aborat, lynn, oackerm, bkorn

Subject: Draft Report

Here is a draft of the report I intend to submit next week.

Please take a look at it and let me know your comments.

Thanks.

----------------Report Starts Here----------------

Opportunities for Expansion

Prepared by Carol Jones

Over the past 6 months, we&#146;ve seen an indication of an increase in the

demand for our services. Current market trends indicate that the demand

will continue for at least 18 months and possibly longer. The manager of

our service staff states &#147;We&#146;re up to our necks in new customers and

:

</PRE>

<!-- END CODE //-->

<P>The message is displayed one screen at a time. Any time you see a colon, you can press &lt;Return&gt; to see the next screen or &lt;q&gt; to quit viewing the message. Press &lt;Return&gt; to see the next screen of the message.

</P>

<P>When you see the last screen, you see <TT>EOF:</TT> (for <I>end of file</I>). Press &lt;q&gt; or &lt;Return&gt; to get back to the <TT>?</TT> prompt. Notice that the greater-than character still points to the message you&#146;ve just read. The message that was the current message is still the current message.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="632-634.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="637-638.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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