postfix conditional recipient rewriting

I'm struggling to integrate Postfix with RT. I'm new to all this so I might be doing some dumb mistakes.

AFAIU, Postfix and RT integrate with a mapping between the RT queue and the recipient address in the /etc/alias file.

We have done this for two queues:

support:    "|/opt/rt4/bin/rt-mailgate --queue general --action correspond --url http://localhost" 
support-urgent "|/opt/rt4/bin/rt-mailgate --queue urgent --action correspond --url http://localhost"

So whenever an email is sent to support@company.com, it gets in queue general and whenever it is sent to support-urgent@company.com, it gets in the other queue.

However, we'd like to simplify the life of our customers by only communicating one single email address to them: support@company.com.

We'd then maintain a list of customers for whom we have a contract that gives them priority.

Basically, we'd need to do some conditional recipient rewriting based on a lookup on the sender address. If X@customerA.com is in our priority list, the recipient address should be changed to support-urgent@company.com for rt to pick it up in the right queue. If B@companyB.com is not on the list, then no rewriting would be necessary.

Is this simple to do or would I require a second Postfix instance on another port?

Thanks for any help or clues. Seb.

1
задан 12 August 2016 в 05:36
2 ответа

RT имеет систему полной автоматизации под названием Scrips, которая позволяет добавлять действия для каждой транзакции в RT-заявке. Используя эту систему, вы можете создать новый скрипт для «Изменить очередь на основе отправителя». Затем вы можете написать код действия, чтобы посмотреть на адрес электронной почты отправителя запроса, проконсультироваться с некоторой конфигурацией, которая сопоставляет домен «от» с вашими очередями, а затем обновить очередь во входящем билете.

Вики сообщества RT имеет пример сценария, который устанавливает очередь автоматически . В вашем случае вы должны иметь возможность просматривать объект Requestor в заявке, поскольку заявка уже создана. Условием будет «Создано».

2
ответ дан 3 December 2019 в 18:33

Если вы знакомы с инструментами Unix, но не знакомы с Perl, вы также можете выполнить эту обработку почты в procmail.

Вам необходимо добавить в свой /etc/procmail/main.cf:

mailbox_command = procmail -a "$EXTENSION"

Пример / etc / procmailrc:

:0
* ^From: .*<+X@customerA.com>+
* ^Subject:.*optional.*
| /opt/rt4/bin/rt-mailgate --action correspond --queue urgent --url http://localhost

Вы можете использовать регулярные выражения для соответствия списку VIP-пользователей или сохранить белый список во внешнем файле

Однако, если вы собираетесь иметь дело с большим количеством конфигурации RT, потратить время на изучение скриптов может быть лучшим вариантом, как предложил Джим.

1
ответ дан 3 December 2019 в 18:33

Теги

Похожие вопросы