<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dipplum.com &#187; procmail</title>
	<atom:link href="http://dipplum.com/tag/procmail/feed/" rel="self" type="application/rss+xml" />
	<link>http://dipplum.com</link>
	<description>Be  the change you wanna see in the world</description>
	<lastBuildDate>Sat, 12 Nov 2011 07:38:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Linux配置IMAP服务器</title>
		<link>http://dipplum.com/2008/10/14/linux-imap-server/</link>
		<comments>http://dipplum.com/2008/10/14/linux-imap-server/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 11:53:58 +0000</pubDate>
		<dc:creator>li</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[fetchmail]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[Maildir]]></category>
		<category><![CDATA[procmail]]></category>
		<category><![CDATA[spamassassin]]></category>

		<guid isPermaLink="false">http://dipplum.com/2008/10/14/linux%e9%85%8d%e7%bd%aeimap%e6%9c%8d%e5%8a%a1%e5%99%a8/</guid>
		<description><![CDATA[IMAP是移动办公中必备的功能, 上网的地方多了, 上网的设备多了, 用的操作系统多了, 什么时候都需要收邮件, 因此不能像POP3那样把邮件收到本地, 而是要放在&#34;云&#34;里. 学校的邮箱只支持POP3, 不支持IMAP. 如果有条件, 我们可以在Linux上自己架设IMAP服务器, 可以把邮件从POP3邮箱下载下来, 放到本地的IMAP服务器上. 通过自己架设的IMAP服务器, 可以实现邮件的移动办公. 1. 安装fetchmail fetchmail可以把邮件从服务器上下载到本地, 首先安装 apt-get install fetchmail 然后编辑fetchmail的配置文件/etc/fetchmailrc. 下面的配置文件每隔10分钟就会将pop3.example.com服务器上remoteuser的邮件下载到本地localuser的邮箱中. set postmaster &#34;localuser&#34; set no bouncemail set daemon 60 poll pop3.example.com proto pop3 interval 10 user 'remoteuser' there with password 'remotepass' is localuser here 最后, 确认/etc/default/fetchmail文件中有START_DAEMON=yes这一行. 重启系统之后, fetchmail服务就会启动. 2. 配置Maildir 用fetchmail下载下来的邮件将通过IMAP提供给邮件客户端访问. [...]]]></description>
			<content:encoded><![CDATA[<p>IMAP是移动办公中必备的功能, 上网的地方多了, 上网的设备多了, 用的操作系统多了, 什么时候都需要收邮件, 因此不能像POP3那样把邮件收到本地, 而是要放在&quot;云&quot;里.</p>
<p>学校的邮箱只支持POP3, 不支持IMAP. 如果有条件, 我们可以在Linux上自己架设IMAP服务器, 可以把邮件从POP3邮箱下载下来, 放到本地的IMAP服务器上. 通过自己架设的IMAP服务器, 可以实现邮件的移动办公.</p>
<p><strong>1. 安装fetchmail</strong></p>
<p>fetchmail可以把邮件从服务器上下载到本地, 首先安装</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> fetchmail</pre></div></div>

</p>
<p>然后编辑fetchmail的配置文件/etc/fetchmailrc. 下面的配置文件每隔10分钟就会将pop3.example.com服务器上remoteuser的邮件下载到本地localuser的邮箱中.</p>
<p><code>set postmaster &quot;localuser&quot;      <br />set no bouncemail       <br />set daemon 60</code></p>
<p><code>poll pop3.example.com proto pop3 interval 10      <br />user 'remoteuser' there with password 'remotepass' is localuser here</code></p>
<p>最后, 确认/etc/default/fetchmail文件中有START_DAEMON=yes这一行. 重启系统之后, fetchmail服务就会启动.</p>
<p><strong>2. 配置Maildir</strong></p>
<p>用fetchmail下载下来的邮件将通过IMAP提供给邮件客户端访问. IMAP支持用户建立多个邮件文件夹, 因此本地用户推荐使用Maildir作为邮件存储方式, 而不是mbox.</p>
<p>运行dpkg-reconfigure exim4-config, 所有其他选项都选择默认. 在Delivery method for local mail选项事, 选择Maildir format in home directory. 此时, fetchmail收下的邮件将存储在用户$HOME/Maildir目录下.</p>
<p><strong>3. 配置dovecot</strong></p>
<p>dovecot提供了Linux下POP3和IMAP服务器的实现, 我们需要安装其IMAP服务器模块. 运行下面命令:</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> dovecot-imapd</pre></div></div>

</p>
<p>Debian默认的配置文件基本上都不需要修改. 但由于我们使用Maildir作为本地邮件存储, 因此需要修改mail_location参数为maildir:~/Maildir. 下面是一个完整的dovecot配置文件的例子(/etc/dovecot/dovecot.conf)</p>
<p><code>protocols: imap imaps      <br />login_dir: /var/run/dovecot/login       <br />login_executable: /usr/lib/dovecot/imap-login       <br />mail_privileged_group: mail       <br />mail_location: maildir:~/Maildir       <br />auth default:       <br />passdb:       <br />driver: pam       <br />userdb:       <br />driver: passwd</code></p>
<p>重启系统之后, IMAP服务器就可以登录了. 用户可以配置邮件客户端, 将邮箱服务器设置为IMAP服务器, 地址为Linux服务器的地址, 用户名和密码就是该机器上localuser的用户名和密码.</p>
<p><strong>4. 配置SpamAssassin(可选)</strong></p>
<p>Linux上提供非常丰富的邮件处理功能, 如垃圾邮件识别, 病毒邮件检查等. SpamAssassin就是一款非常出色的垃圾邮件识别引擎. </p>
<p>在此之前, 用户先通过邮件客户端在IMAP帐号里建立一个专门存放垃圾邮件的文件夹, 例如叫Spam. 然后, 在Linux服务器上, 首先安装spamassassin这款软件.</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> spamassassin</pre></div></div>

</p>
<p>为了把spamassassin和Linux邮件系统上的其他组件联动起来, 实现自动的垃圾邮件过滤, 我们需要用到procmail. 首先在用户的$HOME目录下建立一个.procmailrc文件, 其中包括以下内容</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #007800;">MAILDIR</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>Maildir
<span style="color: #007800;">DEFAULT</span>=<span style="color: #007800;">$MAILDIR</span><span style="color: #000000; font-weight: bold;">/</span>cur
<span style="color: #007800;">LOGFILE</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>procmail.log
&nbsp;
<span style="color: #666666; font-style: italic;"># spam check</span>
:0fw
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>spamassassin
&nbsp;
<span style="color: #666666; font-style: italic;"># filter out spams</span>
:<span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">*</span> ^X-Spam-Flag: YES
<span style="color: #000000; font-weight: bold;">*</span> ^X-Spam-Level: \<span style="color: #000000; font-weight: bold;">*</span>\<span style="color: #000000; font-weight: bold;">*</span>\<span style="color: #000000; font-weight: bold;">*</span>\<span style="color: #000000; font-weight: bold;">*</span>\<span style="color: #000000; font-weight: bold;">*</span>
.Spam<span style="color: #000000; font-weight: bold;">/</span>cur</pre></div></div>

</p>
<p>此时通过所有fetchmail收下的邮件, 都会自动经过spamassassin的过滤, 评分大于5分的邮件, 不会进入收件箱, 而是放在Spam文件夹下.</p>
<p>至此, Linux下的IMAP服务器已经配置完成了.</p>
]]></content:encoded>
			<wfw:commentRss>http://dipplum.com/2008/10/14/linux-imap-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

