Loading ...
Sorry, an error occurred while loading the content.

Configuring/using recipient_delimiter

Expand Messages
  • Olivier Nicole
    Hi, I am pretty new to Postfix. I am trying to set-up a virtual server following the rules in http://howtoforge.org/virtual_postfix_mysql_quota_courier, so far
    Message 1 of 2 , Mar 2 1:06 AM
    • 0 Attachment
      Hi,

      I am pretty new to Postfix. I am trying to set-up a virtual server
      following the rules in
      http://howtoforge.org/virtual_postfix_mysql_quota_courier, so far it
      is working but I would like to send the spam mail into a specific
      folder.

      I get amavisd-new to send the mail to user+junk@domain when it is
      tested to be spam.

      But I don't know, don't understand how to configure Postfix to deliver
      this into ~user/.Junk instad of the normal mailbox.

      I beleive it's possible, but I don't see how to solve the problem.

      Best regards,

      Olivier
    • Magnus Bäck
      On Sunday, March 02, 2008 at 10:06 CET, ... Use a delivery agent capable of filtering messages into different mailboxes depending on, for example, header or
      Message 2 of 2 , Mar 2 1:25 PM
      • 0 Attachment
        On Sunday, March 02, 2008 at 10:06 CET,
        Olivier Nicole <on@...> wrote:

        > I am pretty new to Postfix. I am trying to set-up a virtual server
        > following the rules in
        > http://howtoforge.org/virtual_postfix_mysql_quota_courier, so far it
        > is working but I would like to send the spam mail into a specific
        > folder.
        >
        > I get amavisd-new to send the mail to user+junk@domain when it is
        > tested to be spam.
        >
        > But I don't know, don't understand how to configure Postfix to deliver
        > this into ~user/.Junk instad of the normal mailbox.

        Use a delivery agent capable of filtering messages into different
        mailboxes depending on, for example, header or recipient address
        information. Postfix' virtual(8) is not exactly filtering-enabled, but
        in this particular case it's usable. As you know virtual(8) looks up the
        recipient address in virtual_mailbox_maps and uses the returned mailbox
        path. All you need to do is have an additional query that returns a
        different address if the userpart of the address ends with +junk. You're
        using MySQL so there is no need to store information twice -- construct
        a query that given user+junk@... as input returns the same
        mailbox path as user@... but with /.Junk tacked on at the end.
        Something like this should work, assuming you store user names and
        domain names in separate columns:

        SELECT CONCAT(mailbox_path, '/.Junk/') FROM users
        WHERE '%u' = CONCAT(user, '+junk') AND '%d' = domain

        This query is probably not optimal because of the table scans it may
        force, but lookup latency is probably not a bottleneck for you anyway.

        If you only store complete mail addresses you'll have to resort to using
        SUBSTRING and INDEX, but that's left as an exercise for the reader.

        For the more general case of sorting different messages into different
        folders virtual(8) won't cut it, and since you're using Courier maildrop
        would be the obvious choice of such a delivery agent.

        --
        Magnus Bäck
        magnus@...
      Your message has been successfully submitted and would be delivered to recipients shortly.