<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[iRedMail — [FAQ] How to use procmail to deliver mail (per-user setting)]]></title>
	<link rel="self" href="http://www.iredmail.org/forum/feed-atom-topic480.xml" />
	<updated>2009-12-11T02:45:25Z</updated>
	<generator>PunBB</generator>
	<id>http://www.iredmail.org/forum/topic480-faq-how-to-use-procmail-to-deliver-mail-peruser-setting.html</id>
		<entry>
			<title type="html"><![CDATA[[FAQ] How to use procmail to deliver mail (per-user setting)]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post2057.html#p2057" />
			<content type="html"><![CDATA[<p>This tutorial is used to explain how to use procmail to deliver mails in iRedMail. If they don&#039;t work for you, please post a new topic in <a href="http://www.iredmail.org/forum/forum2-iredmail-general-technical-support.html">iRedMail General Technical Support</a> forum.<br />=====================</p><h5>How to use procmail to deliver mail (per-user setting)<br />=======================</h5><p>Since iRedMail supports <a href="http://www.iredmail.org/forum/topic334-faq-how-to-relay-your-mails-perdomain-or-peruser-ldap-solution.html">per-user transport</a>, it&#039;s possible and easy to set different transport or LDA (local deliver agent) to deliver mails for users.</p><p>Steps to use procmail instead of default sieve LDA:</p><ul><li><p>Add below lines in postfix master.cf</p></li></ul><div class="codebox"><pre><code>procmail unix - n n - - pipe
  flags=DRhu user=vmail:vmail argv=/usr/bin/procmail -r -t SENDER=${sender} RECIPIENT=${recipient} DOMAIN=${nexthop} -m USER=${user} EXTENSION=${extension} /etc/procmailrc</code></pre></div><p>Tip: iRedMail ships a sample procmailrc (iRedMail-x.y.z/samples/procmailrc), you can simplily copy it to /etc/procmailrc, but do NOT forget to change &#039;$HOME&#039; to correct directory. such as:<br /></p><div class="codebox"><pre><code># MAILBOX=&quot;$HOME/$DOMAIN/$USER/&quot;
MAILBOX=&quot;/var/vmail/vmail01/$DOMAIN/$USER/&quot;</code></pre></div><ul><li><p>Create log file if necessary (NOTE: it&#039;s required if you use procmailrc shipped in iRedMail)</p></li></ul><div class="codebox"><pre><code># touch /var/log/procmail.log
# chown vmail:vmail /var/log/procmail.log
# chmod 0700 /var/log/procmail.log</code></pre></div><ul><li><p>Set transport of this user in your MYSQL/LDAP backend.<br /></p><ul><li><p>In MySQL backend, change value of &#039;<strong>transport</strong>&#039; column in <strong>vmail.mailbox</strong> table. set to &#039;<strong>procmail</strong>&#039; (this is what we defined in postfix master.cf).</p></li><li><p>In OpenLDAP backend, change value of &#039;<strong>mtaTransport</strong>&#039; attribute of this user.</p></li></ul></li></ul><ul><li><p><strong>Be CAREFUL</strong>, maildir generated by iRedMail is hashed, but seems procmail can&#039;t find them, so maybe you should change maildir related paths in SQL/LDAP of this user, so that it can receive mails. e.g.<br /></p><ul><li><p>In MySQL backend, you may want to change value of &#039;<strong>storagebasedirectory</strong>&#039; and &#039;<strong>maildir</strong>&#039; columns in <strong>vmail.mailbox</strong> table.</p></li><li><p>In LDAP backend, you may want to change value of &#039;<strong>storageBaseDirectory</strong>&#039; and &#039;<strong>mailMessageStore</strong>&#039; attributes.</p></li><li><p>It&#039;s a good idea to not mix procmail mailboxes and default LDA mailboxes, you may want to use <strong>/var/vmail/procmail01</strong> as storageBaseDirectory instead of <strong>/var/vmail/vmail01</strong> which used by default LDA. And don&#039;t forget to set correct file permission:</p></li></ul></li></ul>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2009-12-11T02:45:25Z</updated>
			<id>http://www.iredmail.org/forum/post2057.html#p2057</id>
		</entry>
</feed>
