How can I get postfix to forward an incoming email to one or more different local alias(es), if the address I want the rule to be based on, is not the recipient? The address I want to act on is from a forwarded mail.

It goes like this:
On external account:

  • voicemail addressed to 123+voicemail@externaldomain gets delivered to the main myname@externaldomain account. (this combines normal text mail and mail with voice attachments)
  • All mail is forwared to my server using tonline@mydomain

On local postfix server:

  • Now I want to forward only voice mail originally addressed to 123+voicemail@externaldomain to my aliases for voice@mydomain and voice@myotherdomain
    That's why I can't simply use bcc_maps

  • In virtual_alias_maps I tried:

    • Using virtual_alias_maps I'm able to redirect
      voice@mydomain to myvoice@mydomain, myvoice@myotherdomain
      but this includes regular mail, too.

    • So I tried a rule like
      123+voice@externaldomain voice@mydomain, voice@myotherdomain
      but this doesn't trigger.

example mail when finally received by me using the rule from my first attempt:

Return-Path: <123@externaldomain>
X-Original-To: voice@mydomain
Delivered-To: myvoice@mydomain    
From: 456 <456@externaldomain>
To: 123+voice@externaldomain
Subject: Call from 456

Since your decision is totally dependant on To header, you can add header_checks

# ...
# ...
header_checks = regexp:/etc/postfix/header.re
# ...

/^To:(.*)123+voice@externaldomain/        REDIRECT  whoever@whateverdomain.tld
  • This works fine to distinguish voice mail from text mail. It seems that virtual is not executed anymore when a Redirect was in action? With virtual I'd be able to spread the mail to multiple users. – user213360 Mar 20 '14 at 20:51

I managed to solve this by using a sieve message filter like this:

require ["copy","fileinto","imap4flags"];
# rule:[VoiceMailForwarder]
if anyof (header :contains "to" "+Sprachbox@t-online.de", header 
:contains "to" "fritzbox@example.com")
    redirect :copy "voicemail@example.com";

using roundcube with the managesieve plugin makes this easy. There is an addon for thunderbird, too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.