I have an email virtual alias in Postfix that forwards the email to another address: email1@domain1.com -> email2@domain2.com. The domain2.com is a catch-all that parses the email and sends it to a script. In the script I can access the email headers, where I see the header To: <email1@domain1.com>
. I would also like to know what is the end recipient, in this example email2@domain2.com
. Do you know any way to add it as a custom header? Thanks
Update:
I'm using Centos 7 with Virtualmin. Here is my postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
authorized_submit_users = root
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mail_owner = postfix
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, domain1
myhostname = mail.domain1.com
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
recipient_canonical_classes = envelope_recipient
recipient_canonical_maps = tcp:127.0.0.1:10002
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sender_bcc_maps = hash:/etc/postfix/bcc
sender_canonical_classes = envelope_sender
sender_canonical_maps = tcp:127.0.0.1:10001
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
The headers that I receive currently in email2@domain2.com are:
X-Envelope-To: <email1@domain1.com>
Received: from mail-qk0-f170.google.com (mail-qk0-f170.google.com [209.85.220.170]) by mail.domain1.com (Postfix) with ESMTP id DD6A419EAE for <email1@domain1.com>; Mon, 14 Mar 2016 14:26:50 +0000 (UTC)
Received: by mail-qk0-f170.google.com with SMTP id s68so75293658qkh.3 for <email1@domain1.com>; Mon, 14 Mar 2016 07:26:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sender1-com.20150623.gappssmtp.com; s=20150623; h=date:subject:from:message-id:mime-version:to; bh=hqH2fYTPM8TH6JmNeCLDMgOPLarFPGZIH9iNM2C8si8=; b=QLx2ne7ecBDzFf7KxvphGmJ3j2ofGv2hPsnDQc/2WGaIsXkrNUactEHg06dHvUx7Fr A6sfsY3ldQeFYctYkaFkHmIIahOA5wU+//vQt63eezyT7DwPPgdV3M325hrRIl/yXtzx /a9i6o9HodPKLO9mzw3O/BFrkhX2/yns8+L4m6flxh7pO6XR/L+7CA52q6tikj3LA0vY I6EVUjALjGESkVvfLQCqz0xqihrydx5ZjHQs8/kejPyHNKjuG1mhT71Aw8fOpm5cr/U4 oFtg8D8mk04KSNCJpPfj4r8q6PWkk2lWmrMZBqVb1lgsc++Ms94OnTUOP66ahkF4FSHe hk0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:subject:from:message-id:mime-version:to; bh=hqH2fYTPM8TH6JmNeCLDMgOPLarFPGZIH9iNM2C8si8=; b=C+MBNHvzJgDJytvU0O77IMci0KDVbBAoE7vjh1l7ywehwO8rbts8g1Aw1rLKqVRC1j 7AuSSNl4Aw24EHrKJ/d0FeeZj7wYttzieAGcoVHO/aU8nU1VB4z1551/JNLdERT12JsJ Q9vi8wSdn/YyywVcQrYAkj2AbJJuVDxAWwnh+DFKMtfSqhSjLouXIgHW3Em/n6HKk/Fo gQ3YX3VcbVhh/Wb1bnhYKa9p+dHycxR/6FqH6iUPfC9FOoyQgyT5Dy22uf14qc+4BfxL aI7zkWZSnrTGvAo0qZYv83Ju9y/OqnIzu+8rtcvvFTMBlfbSRZk7EPHoK6epOvk2gGCr YdUg==
X-Gm-Message-State: AD7BkJJN9qbPo6gcrUH1cqYbdbf1ONXUw66KBuM1smFgz/9/kg7LqgsyGfGxkI5riSw59A==
X-Received: by 10.55.20.224 with SMTP id 93mr31121731qku.109.1457965610167; Mon, 14 Mar 2016 07:26:50 -0700 (PDT)
Received: from localhost (ec2-52-90-4-238.compute-1.amazonaws.com. [52.90.4.238]) by smtp.gmail.com with ESMTPSA id x64sm9199694qhx.47.2016.03.14.07.26.49 for <email1@domain1.com> (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Mar 2016 07:26:49 -0700 (PDT)
Date: Mon, 14 Mar 2016 07:26:40 -0700
X-Mailer: Polymail
Subject: test
From: Jesús Carrera <me@sender1.com>
X-Polymail-Id: 56e6c9f42bcdb00a00000023
Message-ID: <56e6c9f42bcdb00a00000023@polymail.io>
Mime-Version: 1.0
To: <email1@domain1.com>