« MSc: FP >= ATKP -> F = truesurrogates »

mails

2010. Jan. 11.

Permalink 12:43:20 am, by vmiklos, 215 words   English (US)
Categories: hacking

mails

Say you have two servers, the first is just a mail proxy, the second is a real mail server. So the MX record points to the first box and you usually just read your mail on the second one.

We use this system at frugalware.org as well to make the service a bit more robust: if genesis (the “second” box) goes down, the proxy machine(s) can just queue up the input and in case one of the proxy machines go down, then the sender will just try an other proxy.

The problem occurs when the “second” box goes down and you need to read your mail ASAP. Let’s say you have access to the first box. You see in the output of ‘mailq’ that there are messages in the queue but how to read those mails?

‘mailq’ gives the ID of each message, and then the following script (I call it ‘mails’ - s for show) can generate mbox format from it, which means you can read it with for example ‘mutt -f foo.mbox’.

The script itself is fairly easy:

#!/bin/sh

echo 'From news@gmane.org Tue Mar 04 03:33:20 2003'
sudo /usr/sbin/postcat /var/spool/postfix/deferred/${1:0:1}/$1 \
        |sed '1,/^\*\*\* MESSAGE CONTENTS/d;/^\*\*\* HEADER EXTRACTED/,$ d'

(And of course it’s possible there is a better tool to do the job, but I use this for months now.)

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)
July 2010
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Search

Stats

Összesen 1,455 bejegyzés és 307 megjegyzés.

Most views

  • Sparse checkout example in git 1.7.0 (1,422)
  • winning london (987)
  • pacman -Sy: rsync-like optimization (888)
  • pacman-g2 -Qt bug (876)
  • gmane export (853)
  • More...
blogging software