On Tue, Oct 27, 2015 at 04:41:47PM +1300, jer...@smartpoint.co.nz wrote:

> I want to discard mail for a local user but I've read the docs and I'm
> not quite sure exactly how I should go about this. 

Postfix has "discard" transport.  The simplest way is:

        transport:
            discard.invalid     discard:silently

        virtual:
            u...@example.com    user@discard.invalid

This keeps the transport table simple, free of per-user entries,
that might otherwise motivate "slow" LDAP or SQL transport lookups
which are on the critical path for the queue manager.  LDAP and
SQL are just fine for virtual(5) lookups which happen in multiple
smtpd(8) and cleanup(8) processes in parallel.

> I'm operating a virtual domain environment and have addresses mapped to
> local user accounts. I have a "noreply" account which is setup to
> receive messages from numerous addresses. I would like to simply
> discard any email sent to this local user.

Discarding "noreply" may be unwise if mail is sent with "noreply"
as the "From:" or "Reply-To:" address.  In this particular case,
I would go with a per-user transport entry:

    transport:
        nore...@example.com     error:5.1.1 No reply at this address

which rejects any mail sent to that address, so the sender notices
that their reply went nowhere.  Discards should be avoided with
addresses people might inadvertantly send mail to.

> I've tried searching for something similar but most solutions seem to
> be tailored to work with specific email addresses rather than a local
> account. There are too many email addresses mapped to this local user
> to add individual rules for each email address.

Well, each such mapping can be replaced with a transport entry.
One way or another you have a list of addresses to not deliver.

If discard is the wise route, then my initial reply works, but to
reject at SMTP time, each original address must directly resolve
to the error transport before any rewriting.

> I've tried adding a discard line in transport_maps =
> hash:/etc/postfix/transport but I think I'm on the wrong path here.

You provide no detail of what you did, and how it failed.  So the
above is basically content-free.

-- 
        Viktor.

Reply via email to