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

catch all taking emails of valid email accounts

Expand Messages
  • Chris St Denis
    I have some email addresses defined (example.com of course is not the real domain) david@example.com ops@example.com ted@example.com yolanda@example.com and a
    Message 1 of 4 , Oct 1, 2008
    • 0 Attachment
      I have some email addresses defined (example.com of course is not the real domain)

      david@...
      ops@...
      ted@...
      yolanda@...

      and a catch all to ops@...


      when an email is sent to an address like yolanda@... it gets sent to ops@...

      Oct  1 11:11:35 barium postfix/pipe[53799]: DFC9410E463: to=<ops@...>, orig_to=<yolanda@...>, relay=maildrop, delay=0.06, delays=0.01/0/0/0.04, dsn=2.0.0, status=sent (delivered via maildrop service)

      Why is it delivering to the catch all instead of the virtual_mailbox account?

      (virtual_mailbox file here is a dump of the database table)
      barium# grep yolanda@... virtual_mailbox
      yolanda@...   example.com/yolanda/


      barium# grep example.com virtual_alias
      postmaster@...        postmaster@...
      abuse@...     abuse@...
      @...  ops@...



      barium# postconf -n
      alias_maps = hash:/etc/aliases
      bounce_queue_lifetime = 3d
      broken_sasl_auth_clients = yes
      command_directory = /usr/local/sbin
      config_directory = /usr/local/etc/postfix
      daemon_directory = /usr/local/libexec/postfix
      data_directory = /var/db/postfix
      debug_peer_level = 2
      delay_warning_time = 4h
      home_mailbox = Maildir/
      html_directory = no
      inet_interfaces = <snip>
      mail_owner = postfix
      mailbox_transport = virtual
      mailq_path = /usr/local/bin/mailq
      manpage_directory = /usr/local/man
      maximal_queue_lifetime = 3d
      message_size_limit = 20971520
      myhostname = <snip>
      mynetworks = <snip>
      mynetworks_style = subnet
      newaliases_path = /usr/local/bin/newaliases
      proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps proxy:pgsql:/usr/local/etc/postfix/pgsql_virtual_alias_maps.cf proxy:pgsql:/usr/local/etc/postfix/pgsql_virtual_domains_maps.cf proxy:pgsql:/usr/local/etc/postfix/pgsql_virtual_mailbox_maps.cf
      queue_directory = /var/spool/postfix
      readme_directory = no
      sample_directory = /usr/local/etc/postfix
      sendmail_path = /usr/local/sbin/sendmail
      setgid_group = maildrop
      smtp_tls_loglevel = 0
      smtp_tls_note_starttls_offer = yes
      smtp_use_tls = yes
      smtpd_client_connection_count_limit = 25
      smtpd_recipient_restrictions = check_policy_service unix:/var/run/restricted_aliases_policy_server.sock                         permit_mynetworks,                                permit_sasl_authenticated,                                reject_invalid_hostname,                                reject_unknown_recipient_domain,                                reject_unauth_destination,
      smtpd_sasl_auth_enable = yes
      smtpd_sasl_local_domain =
      smtpd_sasl_path = smtpd
      smtpd_sasl_security_options = noanonymous
      smtpd_tls_CAfile = /usr/local/etc/postfix/ssl/smtpd.pem
      smtpd_tls_cert_file = /usr/local/etc/postfix/ssl/smtpd.pem
      smtpd_tls_key_file = /usr/local/etc/postfix/ssl/smtpd.pem
      smtpd_tls_loglevel = 0
      smtpd_tls_received_header = yes
      smtpd_use_tls = yes
      transport_maps = hash:/usr/local/etc/postfix/transport
      unknown_local_recipient_reject_code = 550
      virtual_alias_maps = cdb:/usr/local/etc/postfix/virtual_alias
      virtual_gid_maps = static:125
      virtual_mailbox_base = /usr/home/mail
      virtual_mailbox_domains = proxy:pgsql:/usr/local/etc/postfix/pgsql_virtual_domains_maps.cf
      virtual_mailbox_limit = 51200000
      virtual_mailbox_maps = proxy:pgsql:/usr/local/etc/postfix/pgsql_virtual_mailbox_maps.cf
      virtual_minimum_uid = 125
      virtual_transport = maildrop
      virtual_uid_maps = static:125
    • mouss
      ... This is a FAQ. a catchall really means catch all . and anyway, postfix has no configuration called catchall . what you are using is a wildcard virtual
      Message 2 of 4 , Oct 1, 2008
      • 0 Attachment
        Chris St Denis wrote:
        > I have some email addresses defined (example.com of course is not the
        > real domain)
        >
        > david@...
        > ops@...
        > ted@...
        > yolanda@...
        >
        > and a catch all to ops@...
        >
        >
        > when an email is sent to an address like yolanda@... it gets
        > sent to ops@...


        This is a FAQ. a catchall really means "catch all". and anyway, postfix
        has no configuration called "catchall". what you are using is a wildcard
        virtual alias. and virtual aliases apply to all mail.

        What you want is an "identity mapping" (map an address to itself) for
        valid addresses:

        david@... david@...
        ted@... ted@...
        ...


        These will prevet the wildcard alias from being used (because a match is
        found and alias expansion stops since the result contains the key).

        since you store users in postgres, you can use something like this:

        virtual_alias_maps =
        proxy:pgsql:/usr/local/etc/postfix/pgsql_identity_mapping.cf
        cdb:/usr/local/etc/postfix/virtual_alias

        where the pgsql_identity_mapping.cf has a query that returns the user
        (which is the key of the search query) if it is found in your virtual
        mailbox table:

        ...
        query = select %s from yourvirtualmailboxtable where '%s' = email


        This has been discussed here many times. you may find more infos in the
        archives (search for catchall and/or "identity mapping").

        >
        > Oct 1 11:11:35 barium postfix/pipe[53799]: DFC9410E463:
        > to=<ops@...>, orig_to=<yolanda@...>, relay=maildrop,
        > delay=0.06, delays=0.01/0/0/0.04, dsn=2.0.0, status=sent (delivered via
        > maildrop service)
        >
        > Why is it delivering to the catch all instead of the virtual_mailbox
        > account?
        >

        virtual_alias_maps apply to _all_ mail. yes, _all_ mail. so if you do

        foo@... bar@...

        it will redirect the first to the second, even if these aren't your
        domains.


        > [snip]
      • Victor Duchovni
        ... The first %s should probably also be in quotes or better yet, use the field name: query = select %s from yourvirtualmailboxtable where %s = email
        Message 3 of 4 , Oct 1, 2008
        • 0 Attachment
          On Wed, Oct 01, 2008 at 09:35:04PM +0200, mouss wrote:

          > query = select %s from yourvirtualmailboxtable where '%s' = email

          The first "%s" should probably also be in quotes or better yet, use
          the field name:

          query = select '%s' from yourvirtualmailboxtable where '%s' = email
          query = select email from yourvirtualmailboxtable where '%s' = email

          --
          Viktor.

          Disclaimer: off-list followups get on-list replies or get ignored.
          Please do not ignore the "Reply-To" header.

          To unsubscribe from the postfix-users list, visit
          http://www.postfix.org/lists.html or click the link below:
          <mailto:majordomo@...?body=unsubscribe%20postfix-users>

          If my response solves your problem, the best way to thank me is to not
          send an "it worked, thanks" follow-up. If you must respond, please put
          "It worked, thanks" in the "Subject" so I can delete these quickly.
        • mouss
          ... indeed!
          Message 4 of 4 , Oct 1, 2008
          • 0 Attachment
            Victor Duchovni wrote:
            > On Wed, Oct 01, 2008 at 09:35:04PM +0200, mouss wrote:
            >
            >> query = select %s from yourvirtualmailboxtable where '%s' = email
            >
            > The first "%s" should probably also be in quotes or better yet, use
            > the field name:
            >
            > query = select '%s' from yourvirtualmailboxtable where '%s' = email
            > query = select email from yourvirtualmailboxtable where '%s' = email
            >

            indeed!
          Your message has been successfully submitted and would be delivered to recipients shortly.