- MFen: 1.132 -> 1.136
Obtained from: The FreeBSD Traditional Chinese Project https://opensvn.csie.org/traccgi/freebsddoc/wiki
This commit is contained in:
parent
1af2ce50dc
commit
8795b2c069
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=31084
1 changed files with 98 additions and 106 deletions
|
@ -2,7 +2,7 @@
|
|||
The FreeBSD Documentation Project
|
||||
|
||||
$FreeBSD$
|
||||
Original revision: 1.132
|
||||
Original revision: 1.136
|
||||
-->
|
||||
|
||||
<chapter id="mail">
|
||||
|
@ -30,127 +30,120 @@
|
|||
<title>·§z</title>
|
||||
<indexterm><primary>email</primary></indexterm>
|
||||
|
||||
<para><quote>Electronic Mail</quote>, better known as email, is one of the
|
||||
most widely used forms of communication today. This chapter provides
|
||||
a basic introduction to running a mail server on &os;, as well as an
|
||||
introduction to sending and receiving email using &os;; however,
|
||||
it is not a complete reference and in fact many important
|
||||
considerations are omitted. For more complete coverage of the
|
||||
subject, the reader is referred to the many excellent books listed
|
||||
in <xref linkend="bibliography">.</para>
|
||||
<para><quote>電子郵件</quote>或者俗稱的 email,
|
||||
乃是現今使用最廣泛的溝通方式之一。 本章主要介紹如何在 &os; 上安裝、
|
||||
設定 email 服務,以及如何在 &os; 收發信件; 然而這並不是完整的參考手冊,
|
||||
實際上許多需考量的重要事項並未提及,若欲瞭解細節請參閱 <xref
|
||||
linkend="bibliography"> 內的參考書籍。</para>
|
||||
|
||||
<para>After reading this chapter, you will know:</para>
|
||||
<para>讀完這章,您將了解︰</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>What software components are involved in sending and receiving
|
||||
electronic mail.</para>
|
||||
<para>哪些軟體元件與收發電子郵件有關。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Where basic <application>sendmail</application> configuration
|
||||
files are located in FreeBSD.</para>
|
||||
<para>FreeBSD 內的 <application>sendmail</application>
|
||||
基本設定檔在哪。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The difference between remote and
|
||||
local mailboxes.</para>
|
||||
<para>遠端信箱與本機信箱的區別。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to block spammers from illegally using your mail server as a
|
||||
relay.</para>
|
||||
<para>如何阻擋 spammer(垃圾郵件製造者)非法運用您的郵件伺服器作為
|
||||
relay(轉發中繼點)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to install and configure an alternate Mail Transfer Agent on
|
||||
your system, replacing <application>sendmail</application>.</para>
|
||||
<para>如何安裝、設定其他 Mail Transfer Agent(MTA) 來取代
|
||||
<application>sendmail</application>。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to troubleshoot common mail server problems.</para>
|
||||
<para>如何處理常見的郵件伺服器問題。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to use SMTP with UUCP.</para>
|
||||
<para>如何使用 UUCP 來進行 SMTP。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to set up the system to send mail only.</para>
|
||||
<para>如何設定系統,使其只能發送郵件。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to use mail with a dialup connection.</para>
|
||||
<para>如何在撥接上網環境中,收發郵件。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to configure SMTP Authentication for added security.</para>
|
||||
<para>如何設定 SMTP 驗證,以加強安全性。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to install and use a Mail User Agent, such as
|
||||
<application>mutt</application> to send and receive email.</para>
|
||||
<para>如何安裝、使用 Mail User Agent(MUA) 程式,比如
|
||||
<application>mutt</application> 來收發郵件。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
||||
<para>How to download your mail from a remote <acronym>POP</acronym>
|
||||
or <acronym>IMAP</acronym> server.</para>
|
||||
<para>如何從遠端 <acronym>POP</acronym> 或 <acronym>IMAP</acronym>
|
||||
主機去下載郵件。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>How to automatically apply filters and rules to incoming
|
||||
email.</para>
|
||||
<para>如何在收信方面,自動套用郵件過濾。</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>Before reading this chapter, you should:</para>
|
||||
<para>在開始閱讀這章之前,您需要︰</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Properly set up your network connection
|
||||
(<xref linkend="advanced-networking">).</para>
|
||||
<para>先設好你的網路
|
||||
(<xref linkend="advanced-networking">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Properly set up the DNS information for your mail host
|
||||
(<xref linkend="network-servers">).</para>
|
||||
<para>能正確為郵件伺服器設定 DNS
|
||||
(<xref linkend="network-servers">)。</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Know how to install additional third-party software
|
||||
(<xref linkend="ports">).</para></listitem>
|
||||
<para>知道如何透過 port/package 安裝軟體
|
||||
(<xref linkend="ports">)。</para></listitem>
|
||||
</itemizedlist>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="mail-using">
|
||||
<title>Using Electronic Mail</title>
|
||||
<title>使用電子郵件</title>
|
||||
<indexterm><primary>POP</primary></indexterm>
|
||||
<indexterm><primary>IMAP</primary></indexterm>
|
||||
<indexterm><primary>DNS</primary></indexterm>
|
||||
|
||||
<para>There are five major parts involved in an email exchange. They
|
||||
are: <link linkend="mail-mua">the user program</link>, <link
|
||||
linkend="mail-mta">the server daemon</link>, <link
|
||||
linkend="mail-dns">DNS</link>, <link linkend="mail-receive">a
|
||||
remote or local mailbox</link>, and of course, <link linkend="mail-host">the
|
||||
mailhost itself</link>.</para>
|
||||
<para>在 email 交換的過程中有 5 個主要部分,分別是:<link
|
||||
linkend="mail-mua">MUA</link>、<link linkend="mail-mta">MTA</link>、
|
||||
<link linkend="mail-dns">DNS</link>、<link linkend="mail-receive">
|
||||
遠端或本機的信箱</link>,當然還有 <link linkend="mail-host">郵件主機本身
|
||||
</link>。</para>
|
||||
|
||||
<sect2 id="mail-mua">
|
||||
<title>The User Program</title>
|
||||
<title>MUA 程式</title>
|
||||
|
||||
<para>This includes command line programs such as
|
||||
<application>mutt</application>,
|
||||
<application>pine</application>, <application>elm</application>,
|
||||
and <command>mail</command>, and <acronym>GUI</acronym> programs such as
|
||||
<application>balsa</application>,
|
||||
<application>xfmail</application> to name a few, and something
|
||||
more <quote>sophisticated</quote> like a WWW browser. These
|
||||
programs simply pass off the email transactions to the local
|
||||
<link linkend="mail-host"><quote>mailhost</quote></link>, either
|
||||
by calling one of the <link linkend="mail-mta">server
|
||||
daemons</link> available, or delivering it over <acronym>TCP</acronym>.</para>
|
||||
</sect2>
|
||||
<para>包括一些文字介面的程式,像是
|
||||
<application>mutt</application>、
|
||||
<application>pine</application>、<application>elm</application>、
|
||||
and <command>mail</command>,以及 <acronym>GUI</acronym> 介面的程式,
|
||||
像是 <application>balsa</application>、
|
||||
<application>xfmail</application> 等等。 此外,還有更
|
||||
<quote>複雜的</quote> 像是 WWW 瀏覽器。
|
||||
這些程式會郵件處理交給 <link
|
||||
linkend="mail-host"><quote>郵件主機</quote></link>,或者透過呼叫
|
||||
<link linkend="mail-mta">MTA</link>(若有的話)或者是透過
|
||||
<acronym>TCP</acronym> 來傳遞郵件。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="mail-mta">
|
||||
<title>Mailhost Server Daemon</title>
|
||||
|
@ -1336,17 +1329,7 @@ freefall MX 20 who.cdrom.com</programlisting>
|
|||
via &man.m4.1; preprocessing, where the actual configuration
|
||||
occurs on a higher abstraction level. The &man.m4.1;
|
||||
configuration files can be found under
|
||||
<filename>/usr/src/usr.sbin/sendmail/cf</filename>.</para>
|
||||
|
||||
<para>If you did not install your system with full sources, the
|
||||
<application>sendmail</application> configuration set has been broken out into a separate source
|
||||
distribution tarball. Assuming you have your FreeBSD source code
|
||||
CDROM mounted, do:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /cdrom/src</userinput>
|
||||
&prompt.root; <userinput>cat scontrib.?? | tar xzf - -C /usr/src/contrib/sendmail</userinput></screen>
|
||||
|
||||
<para>This extracts to only a few hundred kilobytes. The file
|
||||
<filename>/usr/share/sendmail/cf</filename>. The file
|
||||
<filename>README</filename> in the <filename>cf</filename>
|
||||
directory can serve as a basic introduction to &man.m4.1;
|
||||
configuration.</para>
|
||||
|
@ -1357,13 +1340,13 @@ freefall MX 20 who.cdrom.com</programlisting>
|
|||
|
||||
<para>First, you have to create your <filename>.mc</filename>
|
||||
file. The directory
|
||||
<filename>/usr/src/usr.sbin/sendmail/cf/cf</filename> contains a
|
||||
<filename>/usr/share/sendmail/cf/cf</filename> contains a
|
||||
few examples. Assuming you have named your file
|
||||
<filename>foo.mc</filename>, all you need to do in order to
|
||||
convert it into a valid <filename>sendmail.cf</filename>
|
||||
is:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/src/usr.sbin/sendmail/cf/cf</userinput>
|
||||
<screen>&prompt.root; <userinput>cd /etc/mail</userinput>
|
||||
&prompt.root; <userinput>make foo.cf</userinput>
|
||||
&prompt.root; <userinput>cp foo.cf /etc/mail/sendmail.cf</userinput></screen>
|
||||
|
||||
|
@ -1656,26 +1639,38 @@ define(`confDELIVERY_MODE',`deferred')dnl</programlisting>
|
|||
|
||||
<procedure>
|
||||
<step>
|
||||
<para>Install <filename role="package">security/cyrus-sasl</filename>
|
||||
<para>Install <filename role="package">security/cyrus-sasl2</filename>
|
||||
from the ports. You can find this port in
|
||||
<filename role="package">security/cyrus-sasl</filename>.
|
||||
<filename role="package">security/cyrus-sasl</filename> has
|
||||
a number of compile time options to choose from and, for
|
||||
the method we will be using here, make sure to select the
|
||||
<option>pwcheck</option> option.</para>
|
||||
<filename role="package">security/cyrus-sasl2</filename>. The
|
||||
<filename role="package">security/cyrus-sasl2</filename> port
|
||||
supports a number of compile-time options. For the SMTP
|
||||
Authentication method we will be using here, make sure that
|
||||
the <option>LOGIN</option> option is not disabled.</para>
|
||||
</step>
|
||||
|
||||
|
||||
<step>
|
||||
<para>After installing <filename role="package">security/cyrus-sasl</filename>,
|
||||
edit <filename>/usr/local/lib/sasl/Sendmail.conf</filename>
|
||||
<para>After installing <filename role="package">security/cyrus-sasl2</filename>,
|
||||
edit <filename>/usr/local/lib/sasl2/Sendmail.conf</filename>
|
||||
(or create it if it does not exist) and add the following
|
||||
line:</para>
|
||||
|
||||
<programlisting>pwcheck_method: passwd</programlisting>
|
||||
<programlisting>pwcheck_method: saslauthd</programlisting>
|
||||
</step>
|
||||
|
||||
<para>This method will enable <application>sendmail</application>
|
||||
to authenticate against your FreeBSD <filename>passwd</filename>
|
||||
<step>
|
||||
<para>Next, install <filename role="package">security/cyrus-sasl2-saslauthd</filename>,
|
||||
edit <filename>/etc/rc.conf</filename> to add the following
|
||||
line:</para>
|
||||
|
||||
<programlisting>saslauthd_enable="YES"</programlisting>
|
||||
|
||||
<para>and finally start the saslauthd daemon:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>/usr/local/etc/rc.d/saslauthd start</userinput></screen>
|
||||
|
||||
<para>This daemon serves as a broker for <application>sendmail</application> to
|
||||
authenticate against your FreeBSD <filename>passwd</filename>
|
||||
database. This saves the trouble of creating a new set of usernames
|
||||
and passwords for each user that needs to use
|
||||
<acronym>SMTP</acronym> authentication, and keeps the login
|
||||
|
@ -1686,14 +1681,14 @@ define(`confDELIVERY_MODE',`deferred')dnl</programlisting>
|
|||
<para>Now edit <filename>/etc/make.conf</filename> and add the
|
||||
following lines:</para>
|
||||
|
||||
<programlisting>SENDMAIL_CFLAGS=-I/usr/local/include/sasl1 -DSASL
|
||||
<programlisting>SENDMAIL_CFLAGS=-I/usr/local/include/sasl -DSASL
|
||||
SENDMAIL_LDFLAGS=-L/usr/local/lib
|
||||
SENDMAIL_LDADD=-lsasl</programlisting>
|
||||
SENDMAIL_LDADD=-lsasl2</programlisting>
|
||||
|
||||
<para>These lines will give <application>sendmail</application>
|
||||
the proper configuration options for linking
|
||||
to <filename role="package">cyrus-sasl</filename> at compile time.
|
||||
Make sure that <filename role="package">cyrus-sasl</filename>
|
||||
to <filename role="package">cyrus-sasl2</filename> at compile time.
|
||||
Make sure that <filename role="package">cyrus-sasl2</filename>
|
||||
has been installed before recompiling
|
||||
<application>sendmail</application>.</para>
|
||||
</step>
|
||||
|
@ -1701,11 +1696,12 @@ SENDMAIL_LDADD=-lsasl</programlisting>
|
|||
<step>
|
||||
<para>Recompile <application>sendmail</application> by executing the following commands:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/src/usr.sbin/sendmail</userinput>
|
||||
&prompt.root; <userinput>make cleandir</userinput>
|
||||
&prompt.root; <userinput>make obj</userinput>
|
||||
&prompt.root; <userinput>make</userinput>
|
||||
&prompt.root; <userinput>make install</userinput></screen>
|
||||
<screen>&prompt.root; <userinput>cd /usr/src/lib/libsmutil</userinput>
|
||||
&prompt.root; <userinput>make cleandir && make obj && make</userinput>
|
||||
&prompt.root; <userinput>cd /usr/src/lib/libsm</userinput>
|
||||
&prompt.root; <userinput>make cleandir && make obj && make</userinput>
|
||||
&prompt.root; <userinput>cd /usr/src/usr.sbin/sendmail</userinput>
|
||||
&prompt.root; <userinput>make cleandir && make obj && make && make install</userinput></screen>
|
||||
|
||||
<para>The compile of <application>sendmail</application> should not have any problems
|
||||
if <filename>/usr/src</filename> has not been changed extensively
|
||||
|
@ -1721,8 +1717,7 @@ SENDMAIL_LDADD=-lsasl</programlisting>
|
|||
|
||||
<programlisting>dnl set SASL options
|
||||
TRUST_AUTH_MECH(`GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN')dnl
|
||||
define(`confAUTH_MECHANISMS', `GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN')dnl
|
||||
define(`confDEF_AUTH_INFO', `/etc/mail/auth-info')dnl</programlisting>
|
||||
define(`confAUTH_MECHANISMS', `GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN')dnl</programlisting>
|
||||
|
||||
<para>These options configure the different methods available to
|
||||
<application>sendmail</application> for authenticating users.
|
||||
|
@ -1750,14 +1745,6 @@ define(`confDEF_AUTH_INFO', `/etc/mail/auth-info')dnl</programlisting>
|
|||
<application>sendmail</application> to 13 and watch
|
||||
<filename>/var/log/maillog</filename> for any errors.</para>
|
||||
|
||||
<para>You may wish to add the following line to <filename>/etc/rc.conf</filename>
|
||||
so this service will be available after every system boot:</para>
|
||||
|
||||
<programlisting>cyrus_pwcheck_enable="YES"</programlisting>
|
||||
|
||||
<para>This will ensure the initialization of <acronym>SMTP_AUTH</acronym> upon system
|
||||
boot.</para>
|
||||
|
||||
<para>For more information, please see the <application>sendmail</application>
|
||||
page regarding
|
||||
<ulink url="http://www.sendmail.org/~ca/email/auth.html">
|
||||
|
@ -1840,7 +1827,7 @@ define(`confDEF_AUTH_INFO', `/etc/mail/auth-info')dnl</programlisting>
|
|||
that should be displayed. In this example, we will read the
|
||||
first email:</para>
|
||||
|
||||
<screen>& <userinput>t 1</userinput>
|
||||
<screen>& <userinput>t 1</userinput>
|
||||
Message 1:
|
||||
From root@localhost Mon Mar 8 14:05:52 2004
|
||||
X-Original-To: marcs@localhost
|
||||
|
@ -1870,7 +1857,7 @@ This is a test message, please reply if you receive it.</screen>
|
|||
single <keycap>.</keycap> on a new line. An example can be seen
|
||||
below:</para>
|
||||
|
||||
<screen>& <userinput>R 1</userinput>
|
||||
<screen>& <userinput>R 1</userinput>
|
||||
To: root@localhost
|
||||
Subject: Re: test
|
||||
|
||||
|
@ -1887,7 +1874,7 @@ EOT</screen>
|
|||
be specified by putting a single <keycap>.</keycap> on a new
|
||||
line.</para>
|
||||
|
||||
<screen>& <userinput>mail root@localhost</userinput>
|
||||
<screen>& <userinput>mail root@localhost</userinput>
|
||||
Subject: <userinput>I mastered mail
|
||||
|
||||
Now I can send and receive email using mail ... :)
|
||||
|
@ -1995,7 +1982,11 @@ EOT</screen>
|
|||
&man.vi.1; command as an editor for creating and replying to
|
||||
emails. This may be customized by the user by creating or
|
||||
editing their own <filename>.muttrc</filename> file in their home directory and setting the
|
||||
<literal>editor</literal> variable.</para>
|
||||
<literal>editor</literal> variable or by setting the
|
||||
<envar>EDITOR</envar> environment variable. See
|
||||
<ulink url="http://www.mutt.org/"></ulink> for more
|
||||
information about configuring
|
||||
<application>mutt</application>.</para>
|
||||
</note>
|
||||
|
||||
<para>In order to compose a new mail message, press
|
||||
|
@ -2018,6 +2009,7 @@ EOT</screen>
|
|||
help, which can be accessed from most of the menus by pressing
|
||||
the <keycap>?</keycap> key. The top line also displays the
|
||||
keyboard shortcuts where appropriate.</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2 id="pine-command">
|
||||
|
@ -2281,7 +2273,7 @@ user "john", with password "XXXXX", is "myth" here;</programlisting>
|
|||
address of <email role="nolink">goodmail@example2.com</email>:</para>
|
||||
|
||||
<programlisting>:0
|
||||
* < 1000
|
||||
* < 1000
|
||||
! goodmail@example2.com</programlisting>
|
||||
|
||||
<para>Send all mail sent to <email>alternate@example.com</email>
|
||||
|
|
Loading…
Reference in a new issue