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

📄 linux-qmail.html

📁 Linus guide, Linus guide, Linus guide,
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Simon Hampton">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.07 [en] (X11; I; Linux 2.2.3 i686) [Netscape]">
   <TITLE>Filtering e-mails between users using qmail</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#551A8B" ALINK="#FF0000">

<H2>
<FONT FACE="Arial,Helvetica">Filtering e-mails between users using qmail</FONT></H2>
<B><FONT FACE="Arial,Helvetica"><FONT SIZE=-1>Created on 10 April 1999</FONT></FONT></B>
<BR><B><FONT FACE="Arial,Helvetica"><FONT SIZE=-1>Last updated on 19 April
1999</FONT></FONT></B>
<BR><B><FONT FACE="Arial,Helvetica"><FONT SIZE=-1>Development stage: ver
1.0</FONT></FONT></B>
<P><FONT FACE="Arial,Helvetica">This guide was written to be part of <A HREF="http://jgo.local.net/LinuxGuide/">Josh's
Linux Guide</A>.</FONT>
<H3>
<FONT FACE="Arial,Helvetica">Introduction and objective</FONT></H3>
<FONT FACE="Arial,Helvetica">A number of commercial ISPs offer their customers
several email aliases to their one mailbox.&nbsp; Many e-mail programs
can filter incoming mails into seperate folders for each alias, but as
Linux provides individual users with a fully seperate login and working
environment, the question is: can incoming mails be seperated and delivered
to users?&nbsp; The answer is yes, but it is not entirely straightforward,
and you need to use some of Linux's most sophisticated programs to achieve
it, hence configuration is a challenge.</FONT>
<P><FONT FACE="Arial,Helvetica">This "howto" looks at the specific example
of forwarding incoming mail for <A HREF="mailto:simon.hampton@tvd.be">simon.hampton@tvd.be</A>
to linux account sim (home directory: /home/sim), and mail for liesbeth.devriendt@tvd.be
to linux account lies (home directory: /home/lies).&nbsp; To collect my
e-mails I need to access the so-called "multidrop" mailbox offered by my
ISP, called mb10099.</FONT>
<P><FONT FACE="Arial,Helvetica">Mails will be collected using fetchmail
(section 1), and passed to qmail (a sendmail replacement, <A HREF="#qmail">section
2</A>) for delivery locally.</FONT>
<H3>
<FONT FACE="Arial,Helvetica">1. <A HREF="http://www.tuxedo.org/~esr/fetchmail/">fetchmail</A>
(4.5.8)</FONT></H3>
<FONT FACE="Arial,Helvetica">fetchmail has probably already been installed
on your system.&nbsp; There appears to be little competition for fetchmail,
but it is clearly the pride of the OSS community (its author, Eric S. Raymond,
wrote the Chathederal and the Bazar).&nbsp; Fetchmail specialises in on-demand
links, especially for temporary connections.&nbsp; Even though I have a
permanent cable TV connection, I have to demand my e-mails as my ISP does
not forward them automatically to customers.</FONT>
<P><FONT FACE="Arial,Helvetica">fetchmail is fairly straightforward to
get running, see for example:</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica">The <A HREF="#http://jgo.local.net/LinuxGuide/linux-mail-client-setup.html">e-mail
guide</A> provides a useful start</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">documentation in /usr/doc/fetchmail-*), and</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">the <A HREF="http://www.tuxedo.org/~esr/fetchmail/fetchmail-FAQ.html">Fetchmail
FAQ</A>, and man pages.</FONT></LI>
</UL>
<FONT FACE="Arial,Helvetica">A simple ~/.fetchmailrc file should look something
like the following:</FONT>
<BLOCKQUOTE><B><TT>set daemon 300</TT></B>
<BR><B><TT>defaults</TT></B>
<BR><B><TT>&nbsp;&nbsp;&nbsp; forcecr</TT></B>
<BR><TT><B>poll hostname.ISP.country </B>with<B> proto POP3</B></TT>
<BR><TT><B>&nbsp;&nbsp;&nbsp; user mb10099 </B>there with<B> password "XXXXXXX"
is * </B>there options<B> keep</B></TT></BLOCKQUOTE>
<FONT FACE="Arial,Helvetica">The words in bold are read and acted upon
by fetchmail, while the normal text is noise that can added as required
and is ignored (more details are in /usr/doc/fetchmail-*/sample.rcfile).&nbsp;
Don't forget to set it to chmod 0600.</FONT>
<BR>&nbsp;
<TABLE BORDER WIDTH="100%" >
<TR VALIGN=TOP>
<TD><B><FONT FACE="Arial,Helvetica">set daemon 300</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">Fetchmail runs in the background and checks
for emails every 5 minutes.&nbsp; You may want run fetchmail by hand if
you have a dial-up connection.</FONT></TD>
</TR>

<TR>
<TD><B><FONT FACE="Arial,Helvetica">poll hostname.ISP.country</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">The poll commands tells fetchmail to check
the following site for emails.&nbsp; When poll is replaced by "skip", this
entry would be ignored.</FONT></TD>
</TR>

<TR>
<TD><B><FONT FACE="Arial,Helvetica">proto POP3</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">Use the POP3 protocol - still probably
the most common, but fetchmail appears to support all others.</FONT></TD>
</TR>

<TR>
<TD><B><FONT FACE="Arial,Helvetica">user username</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">This is the username needed to login.</FONT></TD>
</TR>

<TR>
<TD><B><FONT FACE="Arial,Helvetica">password "XXXXXX"</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">The password to login.&nbsp; This is stored
as plain text in the .fetchmailrc file and is the reason why this file
is required to be set as read/write for the user only.</FONT></TD>
</TR>

<TR VALIGN=TOP>
<TD>
<BR><B><FONT FACE="Arial,Helvetica">is user-name (or "to user-name")</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">Normally, fetchmail would pass mails to
the MTA with a fully qualified RCPT TO address of type hostname@localhost.&nbsp;
The "is" makes fetchmail feed mails with RCPT TO address user-name@localhost.&nbsp;
For our purposes, however, we use "is *", which makes fetchmail pass mails
without modifying the text before the @.</FONT></TD>
</TR>

<TR>
<TD><B><FONT FACE="Arial,Helvetica">keep</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">Especially useful for testing, this command
tells fetchmail to leave all mails on the server.</FONT></TD>
</TR>

<TR>
<TD><B><FONT FACE="Arial,Helvetica">forcecr</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica"><A HREF="http://www.tuxedo.org/~esr/fetchmail/fetchmail-FAQ.html#T2">Just
something that must be added</A></FONT></TD>
</TR>

<TR>
<TD><B><FONT FACE="Arial,Helvetica">local domains</FONT></B></TD>

<TD><FONT FACE="Arial,Helvetica">Depends whether ISP leaves mail headers
alone.&nbsp; If so, fetchmail only has to know its local domain names</FONT></TD>
</TR>
</TABLE>

<P><FONT FACE="Arial,Helvetica">Fetchmail gets the e-mails and forwards
them using SMTP to port 25 on localhost where your "mail transport agent"
(MTA) needs to be waiting/running in order to receive them.</FONT>
<H3>
<A NAME="qmail"></A><FONT FACE="Arial,Helvetica">2. <A HREF="http://www.qmail.org">qmail</A></FONT></H3>
<FONT FACE="Arial,Helvetica">qmail is a MTA replacement for the more ubiquitous
sendmail.&nbsp; Sendmail is reputed to be less secure than qmail and, in
my brief experience, is certainly more complicated to configure (not that
qmail is simple).</FONT>
<P><FONT FACE="Arial,Helvetica">qmail comprises severall small programs
which pass incoming and outgoing mails between themselves seemlessly -
as a result, most of this text refers to qmail generically instead of the
individual components.&nbsp; qmail listens at port 25 for incoming SMTP
traffic (in this case from fetchmail) and then arranges its delivery.&nbsp;
It can also handle outgoing mail too, instead of the mailing components
in email software.</FONT>
<H4>
<FONT FACE="Arial,Helvetica">Installation</FONT></H4>
<FONT FACE="Arial,Helvetica">Installation is not difficult, but is also
not simple.&nbsp; Read the INSTALL and the INSTALL.* files carefully; these
take you in detail through the key stages:</FONT>
<OL>
<LI>
<FONT FACE="Arial,Helvetica">Setup the necessary qmail usernames on your
system</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Compile and install the software and documentation</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Teach qmail your full <A HREF="#hostname">host
name</A></FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Setup up key non-user routing instructions</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Start qmail and test delivery between users
and to the outside</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Setup initd.conf to ensure approopriate listening
on port 25</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Restart initd</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Make hooks for programs that call sendmail</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Test receipt of incoming SMTP mail traffic</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica">Where appropriate, create a SysV script (see
<A HREF="http://metalab.unc.edu/LDP/HOWTO/Mail-HOWTO-4.html">Mail-HOWTO</A>,
download my script)</FONT></LI>
</OL>
<FONT FACE="Arial,Helvetica">The following sites provide further discussion
of the steps involved if INSTALL is insufficiently clear:</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="ftp://koobera.math.uic.edu/www/qmail.html">Dan
Bernstein's homepage</A> (including the <A HREF="http://pobox.com/~djb/qmail/faq.html">FAQ</A>)</FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica"><A HREF="http://www.skyinet.net/~onogos/docs/Qmail-HOWTO">Qmail-HOWTO</A></FONT></LI>

<LI>
<FONT FACE="Arial,Helvetica"><A HREF="http://www.i2k.net/~dougvw/mailqueue.html">Qmail
setup with a PPP connection</A></FONT></LI>
</UL>

<H4>
<FONT FACE="Arial,Helvetica">Basic configuration</FONT></H4>
<FONT FACE="Arial,Helvetica">Although there is much help for installation
available on the net, there is rather less on configuration.</FONT>
<P><FONT FACE="Arial,Helvetica">As qmail will not be running as a permanently
connected SMTP server, it will not be able to find your domain address
in DNS (a 'virtual domain').&nbsp; Recall also that fetchmail delivers
to the localhost domain.&nbsp; As a result, qmail needs to know that it
must accept mails destined for the localhost domain:</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica">add localhost to /var/qmail/control/rcpthosts</FONT></LI>

⌨️ 快捷键说明

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