<?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>Janeks random writings &#187; getmail</title>
	<atom:link href="http://www.hellqvist.com/janek/weblog/tag/getmail/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hellqvist.com/janek/weblog</link>
	<description>No, it's not another diary.</description>
	<lastBuildDate>Fri, 22 Jan 2010 23:45:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Re-injecting emails collected on a different host (like a MX backup) into Postfix</title>
		<link>http://www.hellqvist.com/janek/weblog/2010/01/23/re-injecting-emails-collected-on-a-different-host-like-a-mx-backup-into-postfix/</link>
		<comments>http://www.hellqvist.com/janek/weblog/2010/01/23/re-injecting-emails-collected-on-a-different-host-like-a-mx-backup-into-postfix/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 23:45:22 +0000</pubDate>
		<dc:creator>Janek</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[getmail]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://www.hellqvist.com/janek/weblog/?p=39</guid>
		<description><![CDATA[Due to recent hosting troubles I had to quickly deploy a backup MX for my primary mail server. This was quickly achieved using a VPS hosted by the Swedish webhost GleSys.
But since my customers needed to be able to read and reply to emails while the primary site was down, I couldn&#8217;t just let the [...]]]></description>
			<content:encoded><![CDATA[<p>Due to recent hosting troubles I had to quickly deploy a backup MX for my primary mail server. This was quickly achieved using a VPS hosted by the Swedish webhost <a href="http://www.glesys.se">GleSys</a>.</p>
<p>But since my customers needed to be able to read and reply to emails while the primary site was down, I couldn&#8217;t just let the backup system keep the incoming email in the queue and deliver them once the primary sit was up. I decided to deliver the emails locally but also keep a copy of all emails that passed through the system.</p>
<p>These archived emails were to be re-delivered once the primary site was up again, and here&#8217;s how I did it, step by step.</p>
<ul>
<li>Set up a VPS for the backup MX host.</li>
<li>Set up the system using the same guide I used for the primary site, which was the great <a href="http://workaround.org/articles/ispmail-etch/">ISPmail tutorial</a> by <em>Christoph Haas</em>.</li>
<li>Added the option always_bcc to the Postfix config, pointing it to a new local mailbox.</li>
<li>Once the primary server was up again, I set up getmail like this:
<ul>
<li>
<pre>[retriever]
type = SimplePOP3Retriever
server = hostname_of_backup_mx
username = username_of_backup_account
password = secret</pre>
<pre>[destination]
type = MDA_external
arguments = ("-i", "-bm", "-t")</pre>
<pre>[options]
verbose = 2</pre>
</li>
</ul>
</li>
</ul>
<p>Running getmailrc quickly restored all the emails on the primary host. Remember not to run it multiple times since the default is to re-download already processed messages.</p>
<p>The downsides of this setup:</p>
<ul>
<li>Deleted emails (like spam) are seen again by the users. POP users will receive duplicates of already retrieved messages. IMAP users will however have a mailbox which includes both old messages and the ones delivered to the backup server.</li>
<li>The spam filter wasn&#8217;t used in delivery process. I realize this could be achieved with fetchmail (which includes the SMTP delivery option that getmail lacks) but I decided to use getmail anyway.</li>
</ul>
<p>I realize there might be prettier solutions to the original problem (BOTH delivering emails locally and keeping them in a queue for a primary MX), but I couldn&#8217;t find out how and this proved to be a pretty solid solution. Feel free to suggest better ways to solve the problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hellqvist.com/janek/weblog/2010/01/23/re-injecting-emails-collected-on-a-different-host-like-a-mx-backup-into-postfix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
