📄 645-648.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=645-648//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="643-645.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="648-650.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading20"></A><FONT COLOR="#000077">Using Aliases and Mailing Lists</FONT></H4>
<P>The <TT>mail</TT> program, like most e-mail programs, allows you to create an alias for an address and a group alias for a list of addresses. You can treat the group alias as a mailing list. Using an alias for an individual address is easier than using the regular address because the alias is typically shorter and easier to remember.</P>
<P>To set an individual or group alias for one mail session, you use the <TT>alias</TT> command at the <TT>?</TT> prompt while you’re reading your e-mail. To make the aliases more useful, put the aliases in a file named .mailrc in your home directory (as described in the following section).</P>
<P>The following is an example of setting and using aliases with the <TT>mail</TT> program:</P>
<DL>
<DD><B>1.</B> Start <TT>mail</TT> by entering <TT><B>mail</B></TT> at the prompt. After the headers are presented, you see the <TT>?</TT> prompt:
<!-- CODE //-->
<PRE>
mail Type ? for help.
“/var/spool/mail/bkorn”: 5 messages 2 new 1 unread
1 sarah Wed Jan 5 09:17 15/363
2 croster@kite.fish.com Thu Jan 6 10:18 26/657 Meeting on
Friday
U 3 wjones Fri Jan 7 08:09 32/900 Framistan Order
> N 4 chendric Fri Jan 7 13:22 35/1347 Draft Report
N 5 kackerma@ps.com Sat Jan 8 13:21 76/3103 Excerpt from GREAT
new Linux
?
</PRE>
<!-- END CODE //-->
<DD><B>2.</B> To set up an individual alias, use the <TT>alias</TT> command followed by the alias for the address. The following example creates the alias ros for the address croster@kite.fish.com:
<!-- CODE SNIP //-->
<PRE>
alias ros croster@kite.fish.com
</PRE>
<!-- END CODE SNIP //-->
<DD><B>3.</B> Use the ros alias in an address; <TT>mail</TT> expands it to its complete form. For example, you can enter the command <TT><B>m</B></TT> <TT><B>ros</B></TT> to start a message you want to mail to croster@kite.fish.com.
</DL>
<P>To set up a group alias, use the <TT>alias</TT> command followed by the alias for the addresses. The following creates an alias called friends and then forwards some mail to the group:</P>
<!-- CODE SNIP //-->
<PRE>
<B>alias friends chendric karlack abc.com!homebase!fran eca@xy.srt.edu</B>
<B>m friends</B>
Subject: <B>Excerpts from new Linux book - get a copy!</B>
<B>~f 5</B>
Interpolating: 5
~.
EOT
?
</PRE>
<!-- END CODE SNIP //-->
<H3><A NAME="Heading21"></A><FONT COLOR="#000077">Customizing Your <I>mail</I> Environment
</FONT></H3>
<P>You can customize your <TT>mail</TT> environment by putting commands or set-environment variables in the .mailrc file in your home directory. The <TT>mail</TT> program checks that file whenever you use the program. You can set quite a few environment variables and commands in .mailrc, and different mail programs will use different commands. Check your man page for your mail program for a list of all the .mailrc options. Some of the commands <TT>mail</TT> recognizes are given earlier in the section “Getting Help with <TT>mail</TT>”; this section describes a subset of the commands and variables that can be used in the .mailrc file. Table 33.1 lists these commands; Table 33.2 lists the environment variables.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 33.1</B> <TT>mail</TT> Commands
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="20%" ALIGN="LEFT">Command
<TH WIDTH="80%" ALIGN="LEFT">Definition
<TR>
<TD COLSPAN="2"><HR>
<TR>
<TD><TT>#</TT>
<TD>Denotes a comment. No action is taken.
<TR>
<TD VALIGN="TOP"><TT>alias</TT>
<TD>Sets an individual or group alias. Used as <TT>alias <I>alias-name address-list</I></TT>.
<TR>
<TD VALIGN="TOP"><TT>set</TT>
<TD>Sets an environment variable. Used as <TT>set <I>variable-name</I></TT> or <TT>set <I>variable-name=string</I></TT>.
<TR>
<TD COLSPAN="2"><HR>
<TR>
</TABLE>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B>You can issue any of the commands in Table 33.1 from the <TT>?</TT> prompt anytime you use <TT>mail</TT>; they’ll be active only for that session.<HR></FONT>
</BLOCKQUOTE>
<TABLE WIDTH="100%">
<CAPTION ALIGN=LEFT><B>Table 33.2</B> <TT>mail</TT> Environment Variables
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="20%" ALIGN="LEFT">Variable
<TH WIDTH="80%" ALIGN="LEFT">Definition
<TR>
<TD COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP"><TT>askcc</TT>
<TD>Prompts for the cc: list after the message is entered. Default is <TT>noaskcc</TT>.
<TR>
<TD VALIGN="TOP"><TT>asksub</TT>
<TD>Prompts for the <TT>Subject</TT> list before the message is entered. Enabled by default.
<TR>
<TD VALIGN="TOP"><TT>noheader</TT>
<TD>Doesn’t print header information on available messages when you start <TT>mail</TT>. Disabled by default.
<TR>
<TD VALIGN="TOP"><TT>ignore</TT>
<TD>Ignores interrupt characters when you enter messages. Useful if you have a “noisy” connection over some telephone or other communication lines. Default is <TT>noignore</TT>.
<TR>
<TD VALIGN="TOP"><TT>metoo</TT>
<TD>When you have your name in a group alias, a message normally isn’t sent to you. Setting this variable allows you to receive messages sent to a group alias that contains your address. Default is <TT>nometoo</TT>.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B>You can set a system-wide environment by putting the commands or set variables in the /etc/mail.rc file.<HR></FONT>
</BLOCKQUOTE>
<P>The following example sets up the .mailrc file so that you use the commands and environment variables listed in Tables 33.1 and 33.2. The pound sign (#) is used to document the work. You can create this file by using <TT>vi</TT> or any other editor that can produce a text or ASCII file.</P>
<!-- CODE //-->
<PRE>
# .mailrc file for D. Wayne Love
# make sure interrupts are NOT ignored
set noignore
# set variables so that prompts for Subject and Cc always appear
set asksub
set askcc
# individual aliases
alias billy wcuth
alias ben benjamin@flagstaff.abaced.com
alias me dwlove
# group aliases, mailing list
alias mercs miles@dendarii.net quinn taura
alias research jones brown smith
alias googol djames bkorn cam@googol.org bkorn
</PRE>
<!-- END CODE //-->
<P>Place these statements in the .mailrc file. Now whenever you start <TT>mail</TT>, these command statements are processed.</P>
<H3><A NAME="Heading22"></A><FONT COLOR="#000077">Quitting the <I>mail</I> Program
</FONT></H3>
<P>As you read e-mail in a mailbox, you can read, skip, or delete messages. (You learn about deleting messages later in this chapter.) These actions don’t take place in the mailbox itself, but in a temporary copy of the mailbox. You can quit the e-mail program so that your mailbox is changed by your actions (the modified temporary copy replaces the original mailbox), or you can quit so that your mailbox is unchanged regardless of what you did during your e-mail session.
</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="643-645.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="648-650.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 + -