Re: Keeping a copy of all mail, and then removing headers from outbound
In that case, it should be safe to have the option in main.cf, because LMTP mail delivery uses lmtp_header_checks instead of smtp_header_checks. Thanks, Wietse. It worked like a charm. -- Lars Preben Sørsdahl lars.preben.no
Re: Keeping a copy of all mail, and then removing headers from outbound
What I'm trying to achieve is for Postfix to deliver a copy to a local IMAP account, and then remove our internal/private headers before passing the mail on to the relay host. The idea is for some custom software to read the copy from the IMAP account, using the interal/private headers for integration with other systems. Use smtp_header_checks=pcre:/path/to/file to remove the headers from outbound mail. If you also use LMTP or SMTP to deliver local IMAP accounts, one extra step is needed. I'm not going to complicate the solution if this step is not needed. Wietse Yes, I'm using LMTP for delivering the bcc copy to an IMAP account, so please tell me about the extra step. :) From main.cf: always_bcc=myaccount mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp relayhost=[smtp.sendgrid.net]:587 Mail sent to custo...@example.com via Postfix should be copied to the myaccount IMAP account with all it's original headers, but I want to remove the X-Cusomer-ID (and possible some others) from the mail when it's delivered to the external relayhost. -- Lars Preben Sørsdahl lars.preben.no
Re: Keeping a copy of all mail, and then removing headers from outbound
Lars Preben S?rsdahl: What I'm trying to achieve is for Postfix to deliver a copy to a local IMAP account, and then remove our internal/private headers before passing the mail on to the relay host. The idea is for some custom software to read the copy from the IMAP account, using the interal/private headers for integration with other systems. Wietse: Use smtp_header_checks=pcre:/path/to/file to remove the headers from outbound mail. If you also use LMTP or SMTP to deliver local IMAP accounts, one extra step is needed. I'm not going to complicate the solution if this step is not needed. Lars Preben S?rsdahl: Yes, I'm using LMTP for delivering the bcc copy to an IMAP account, so please tell me about the extra step. :) From main.cf: always_bcc=myaccount mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp relayhost=[smtp.sendgrid.net]:587 In that case, it should be safe to have the option in main.cf, because LMTP mail delivery uses lmtp_header_checks instead of smtp_header_checks. /etc/postfix/main.cf: smtp_header_checks = pcre:/path/to/file Wietse
Keeping a copy of all mail, and then removing headers from outbound
All our internal machine generated emails are sent through our Postfix server (which is only used for outbound mail), and then relayed out to a third party MTA. To be able to integrate all outbound mail to other services (like CRM), we are adding a few headers (customer number etc) to the mail that is delivered to Postfix. What I'm trying to achieve is for Postfix to deliver a copy to a local IMAP account, and then remove our internal/private headers before passing the mail on to the relay host. The idea is for some custom software to read the copy from the IMAP account, using the interal/private headers for integration with other systems. Delivering a copy of all mail is easy using the always_bcc option, but adding header_checks, with an IGNORE instruction for our internal headers, removes the headers _before_ the local copy is delivered. In other words: The headers are removed from both our bcc-copy and the one forwarded to the relayhost. I understand this is because the cleanup is done before the delivery, but I don't see how I can configure this to achieve the result I need. Any tips is highly appreciated. :) -- Lars Preben Sørsdahl lars.preben.no
Re: Keeping a copy of all mail, and then removing headers from outbound
Lars Preben S?rsdahl: All our internal machine generated emails are sent through our Postfix server (which is only used for outbound mail), and then relayed out to a third party MTA. To be able to integrate all outbound mail to other services (like CRM), we are adding a few headers (customer number etc) to the mail that is delivered to Postfix. What I'm trying to achieve is for Postfix to deliver a copy to a local IMAP account, and then remove our internal/private headers before passing the mail on to the relay host. The idea is for some custom software to read the copy from the IMAP account, using the interal/private headers for integration with other systems. Delivering a copy of all mail is easy using the always_bcc option, but adding header_checks, with an IGNORE instruction for our internal headers, removes the headers _before_ the local copy is delivered. In other words: The headers are removed from both our bcc-copy and the one forwarded to the relayhost. I understand this is because the cleanup is done before the delivery, but I don't see how I can configure this to achieve the result I need. Any tips is highly appreciated. :) Use smtp_header_checks=pcre:/path/to/file to remove the headers from outbound mail. If you also use LMTP or SMTP to deliver local IMAP accounts, one extra step is needed. I'm not going to complicate the solution if this step is not needed. Wietse