From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qeyag-0005VX-Rh for garchives@archives.gentoo.org; Fri, 08 Jul 2011 00:06:43 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4D1FD21C170 for ; Fri, 8 Jul 2011 00:06:42 +0000 (UTC) Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com [209.85.220.181]) by pigeon.gentoo.org (Postfix) with ESMTP id BF37A21C024 for ; Fri, 8 Jul 2011 00:00:04 +0000 (UTC) Received: by vxa40 with SMTP id 40so1343330vxa.40 for ; Thu, 07 Jul 2011 17:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=OOzPnH2HxAI1h7R1j4rjAm04Mi7EOqDO/KVolzx7HWw=; b=A+JQOK0iB3vbwkxIq82Nc9OTePI2HUC1OFJ8TfgQgk5knHOvwEzFQH0OlJ1mz/X7JK AiuObgsWrMS+r4afP8OleITd/EyyrnOT0LE48SOylgFdKCUle87TtZGPlXlNzVLkvz8Q LFw576TO9BN737shn1zsBTzY5lOJc3uRIDYF0= Received: by 10.52.32.201 with SMTP id l9mr1920651vdi.15.1310083204094; Thu, 07 Jul 2011 17:00:04 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-server@lists.gentoo.org Reply-to: gentoo-server@lists.gentoo.org MIME-Version: 1.0 Received: by 10.52.166.197 with HTTP; Thu, 7 Jul 2011 16:59:44 -0700 (PDT) In-Reply-To: <4E16324B.7080904@badapple.net> References: <4E16324B.7080904@badapple.net> From: Paul Hartman Date: Thu, 7 Jul 2011 18:59:44 -0500 Message-ID: Subject: Re: [gentoo-server] Postfix: Can I insert a custom header to incoming mail? To: gentoo-server@lists.gentoo.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 3a22798ebf76ecb6b390b642be878ca4 On Thu, Jul 7, 2011 at 5:25 PM, kashani wrote: > On 7/7/2011 2:50 PM, Paul Hartman wrote: >> >> The idea: >> >> Assuming I can't do anything about how Postfix handles the >> Delivered-To header, I'd like to insert a new header entry >> (X-Originally-To: or something like that) into incoming mail before it >> hits the catchall forward, so I can know to whom the email was >> originally addressed... but i don't really know where to begin. >> >> The question: >> >> Are there any postfix gurus out there who can point me in the right >> direction? Thanks in advance for any tips or advice (or if you want to >> tell me that I'm doing it all wrong). > > It should already be there at least in 2.7.4 which is stable unless you'v= e > really tweaked your main.cf. I'd run a postconf | grep enable_orig and se= e > if it's not set to yes. > > kashani > > http://www.postfix.org/postconf.5.html > > enable_original_recipient (default: yes) > > =A0 =A0Enable support for the X-Original-To message header. This header i= s > needed for multi-recipient mailboxes. Hi kashani, I actually read about that option when I was trying to make this happen (forgot about it when composing my original message). Googling that option I found that most people were interested in combining multi-recipient messages to one on disk (to save space). Indeed the option is already set to "yes" on my setup, but I still don't get that header. I supposed that it has nothing to do with the address I'm interested in (from the envelope) and instead is looking at the To: name from headers (which is unchanged). Or because my message does not have multiple recipients. But maybe I'm completely misunderstanding what it's all about. Here's what an incoming mail to catchall looks like in my syslog: Jul 4 22:11:10 virtual postfix/smtpd[3032]: connect from mail-iw0-f174.google.com[209.85.214.174] Jul 4 22:11:10 virtual sqlgrey: grey: domain awl match: updating 209.85.214(209.85.214.174), gmail.com Jul 4 22:11:10 virtual postfix/smtpd[3032]: E66CA19F0D: client=3Dmail-iw0-f174.google.com[209.85.214.174] Jul 4 22:11:10 virtual postfix/cleanup[3043]: E66CA19F0D: message-id=3D<4E127EDC.6050308@gmail.com> Jul 4 22:11:11 virtual postfix/qmgr[2633]: E66CA19F0D: from=3D, size=3D1689, nrcpt=3D1 (queue active) Jul 4 22:11:11 virtual dovecot: auth: mysql(/var/run/mysqld/mysqld.sock): Connected to database postfixadmin Jul 4 22:11:11 virtual dovecot: lda(catchall@example.com): msgid=3D<4E127EDC.6050308@gmail.com>: saved mail to INBOX Jul 4 22:11:11 virtual postfix/qmgr[2633]: E66CA19F0D: removed Jul 4 22:11:11 virtual postfix/pipe[3045]: E66CA19F0D: to=3D, orig_to=3D, relay=3Ddovecot, delay=3D0.22, delays=3D0.18 /0.01/0/0.03, dsn=3D2.0.0, status=3Dsent (delivered via dovecot service) Jul 4 22:11:41 virtual postfix/smtpd[3032]: disconnect from mail-iw0-f174.google.com[209.85.214.174] So it does run cleanup (and before passing the msg to dovecot) and there is reference to orig_to so at least I know postfix realizes there's a difference. Maybe this should be done by dovecot instead? Here is my main.cf (comment blocks removed): [cut] queue_directory =3D /var/spool/postfix command_directory =3D /usr/sbin daemon_directory =3D /usr/lib64/postfix data_directory =3D /var/lib/postfix mail_owner =3D postfix myhostname =3D virtual.example.com unknown_local_recipient_reject_code =3D 550 debugger_command =3D PATH=3D/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path =3D /usr/sbin/sendmail newaliases_path =3D /usr/bin/newaliases mailq_path =3D /usr/bin/mailq setgid_group =3D postdrop html_directory =3D /usr/share/doc/postfix-2.8.3-r2/html manpage_directory =3D /usr/share/man sample_directory =3D /etc/postfix readme_directory =3D /usr/share/doc/postfix-2.8.3-r2/readme home_mailbox =3D .maildir/ dovecot_destination_recipient_limit =3D 1 virtual_transport =3D dovecot smtpd_sasl_auth_enable =3D yes smtpd_sasl_type =3D dovecot smtpd_sasl_path =3D private/auth virtual_alias_maps =3D mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_mailbox_domains =3D mysql:/etc/postfix/mysql_virtual_domain_maps.cf virtual_mailbox_maps =3D mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf smtpd_sender_restrictions=3D reject_non_fqdn_sender smtpd_reject_unlisted_sender =3D yes smtpd_recipient_restrictions=3D permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unauth_destination, check_policy_service inet:127.0.0.1:2501 smtpd_milters =3D unix:/var/run/dk-filter/dk-filter.sock, unix:/var/run/dkim-filter/dkim-filter.sock, inet:localhost:8026 non_smtpd_milters =3D unix:/var/run/dk-filter/dk-filter.sock, unix:/var/run/dkim-filter/dkim-filter.sock, inet:localhost:8026 inet_protocols =3D all [cut] As I basically followed the wiki, I have no idea if this config is ordinary or not. :) Thanks again for your help. Thanks, Paul