1

for each incoming mail it's needed to send a mail to the original sender to inform him, that all or some recipient addresses have changed. Currently I initiate a BCC and forward it to a script. Unfortunately I found no way to send each original recipient as parameter. So I try to analyze the header, but this do not work in some cases. So perfect would be a recipient list as array as paramater for my script. Any way to realize it? I'm using postfix 2.11 The current relevant configuration is:

main.cf:

recipient_bcc_maps = pcre:$config_directory/bcc.pcre

bcc.pcre:/^(.*)@domain.tld$/    ${1}@domain.tld@autoreply.local

transport:autoreply.local   autoreply:

master.cf:autoreply  unix  -       n       n       -       -       pipe
  flags= user=nobody argv=/usr/bin/php -f /etc/postfix/autoreply/autoreply.php ${sender} ${mailbox} ${queue_id}

E.g there is mail from sender@whatever.tld to

user1@this_domain_should_be_rewritten.tld

user2@this_domain_should_be_rewritten.tld

user3@another_domain.tld (will be ignored)

Postfix is now using mariaDB and is forwarding the mail for user1 & user2 to

user1@new_domain.tld

user2@new_domain.tld

and a BBC mail was send to my script with user1@new_domain.tld@autoreply.local. I see an entry for each user in the maillog but at last it's only one real mail for my script with these paramters:

${sender} = sender@whatever.tld

${mailbox} = user1@new_domain.tld

and the mail itself as STDIN. The purpose is, to send a mail to sender@whatever.tld with the content, that some e-mail addresses have changed, with a list of all affected users - (user1 and user2). I'm starting to search for To: and Cc: in the header but in more cases than you think these data are not part of the header, so that I've no chance to get the needed data. And at last it's a text analyzies which is not very safe. So I would be happy if I can provide the data (each single sender) in a direct way to my script, no matter with or without user3.

Thank you for your participation!!

Lorem ipsum
  • 852
  • 3
  • 13
Rostivar
  • 11
  • 3

0 Answers0