Gentoo Archives: gentoo-server

From: kashani <kashani-list@××××××××.net>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] Postfix: Can I insert a custom header to incoming mail?
Date: Fri, 08 Jul 2011 01:06:27
Message-Id: 4E165246.5070700@badapple.net
In Reply to: Re: [gentoo-server] Postfix: Can I insert a custom header to incoming mail? by Paul Hartman
1 On 7/7/2011 4:59 PM, Paul Hartman wrote:
2 > On Thu, Jul 7, 2011 at 5:25 PM, kashani<kashani-list@××××××××.net> wrote:
3 >> On 7/7/2011 2:50 PM, Paul Hartman wrote:
4 >>>
5 >>> The idea:
6 >>>
7 >>> Assuming I can't do anything about how Postfix handles the
8 >>> Delivered-To header, I'd like to insert a new header entry
9 >>> (X-Originally-To: or something like that) into incoming mail before it
10 >>> hits the catchall forward, so I can know to whom the email was
11 >>> originally addressed... but i don't really know where to begin.
12 >>>
13 >>> The question:
14 >>>
15 >>> Are there any postfix gurus out there who can point me in the right
16 >>> direction? Thanks in advance for any tips or advice (or if you want to
17 >>> tell me that I'm doing it all wrong).
18 >>
19 >> It should already be there at least in 2.7.4 which is stable unless you've
20 >> really tweaked your main.cf. I'd run a postconf | grep enable_orig and see
21 >> if it's not set to yes.
22 >>
23 >> kashani
24 >>
25 >> http://www.postfix.org/postconf.5.html
26 >>
27 >> enable_original_recipient (default: yes)
28 >>
29 >> Enable support for the X-Original-To message header. This header is
30 >> needed for multi-recipient mailboxes.
31 >
32 > Hi kashani,
33 >
34 > I actually read about that option when I was trying to make this
35 > happen (forgot about it when composing my original message). Googling
36 > that option I found that most people were interested in combining
37 > multi-recipient messages to one on disk (to save space). Indeed the
38 > option is already set to "yes" on my setup, but I still don't get that
39 > header. I supposed that it has nothing to do with the address I'm
40 > interested in (from the envelope) and instead is looking at the To:
41 > name from headers (which is unchanged). Or because my message does not
42 > have multiple recipients. But maybe I'm completely misunderstanding
43 > what it's all about.
44
45 I think I've got it figured out and this is your culprit.
46
47 http://en.gentoo-wiki.com/wiki/Mail_server_using_Postfix_and_Dovecot#Dovecot_Integration_-_LDA
48
49 This is because Postfix adds the x-original-to when it delivers, but not
50 when it passes the mail via lmtp to Dovecot. See this Dovecot thread for
51 some details.
52
53 http://www.dovecot.org/list/dovecot/2011-January/056787.html
54
55 The primary benefits of Dovecot LDA seem to be cache files and Sieve.
56 http://wiki.dovecot.org/LDA/Indexing
57 http://wiki.dovecot.org/LDA/Sieve
58
59 If you aren't using Sieve, I would try is using virtual_transport =
60 virtual instead of virtual_transport = dovecot
61
62 You might need to change some settings in your Dovecot config to match
63 where Postfix will deliver the emails, specifically mail_location =
64 maildir:/var/mail/%d/%n/Maildir/:INDEX=/var/mail/%d/%n/indexes
65
66 This are the settings I use for Postfix w/ Courier. Should work with
67 Dovecot, but again you might need to change things a bit.
68
69 # virtual stuff
70 virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
71 virtual_gid_maps = static:207
72 virtual_mailbox_base = /var/mail/
73 virtual_mailbox_domains =
74 proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
75 virtual_mailbox_limit = 512400000
76 virtual_mailbox_maps =
77 proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
78 virtual_minimum_uid = 207
79 virtual_transport = virtual
80 virtual_uid_maps = static:207
81
82 kashani

Replies

Subject Author
Re: [gentoo-server] Postfix: Can I insert a custom header to incoming mail? Paul Hartman <paul.hartman@×××××.com>
Re: [gentoo-server] Postfix: Can I insert a custom header to incoming mail? Paul Hartman <paul.hartman@×××××.com>