0

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

2 Answers 2

0

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

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

#/etc/postfix/header.re
/^To:(.*)123+voice@externaldomain/        REDIRECT  [email protected]
1
  • 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, 2014 at 20:51
0

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

require ["copy","fileinto","imap4flags"];
# rule:[VoiceMailForwarder]
if anyof (header :contains "to" "[email protected]", header 
:contains "to" "[email protected]")
{
    redirect :copy "[email protected]";
}

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .