Custom bounce message

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom bounce message

Andrea Gozzi-2
Hi.
I currently run a website, mydomain.com, and there are a bunch of email
users so I have a postfix installation taking care of it.
This is all running on a housed server thousand of miles away from my
workplace.
A couple months ago I purchased mydomain.net and set up a redirect
towards mydomain.com, so all http requests were taken care of.
Since I wasn't expecting any mail to @mydomain.net I didn't bother much
about it. I just added an entry in the virtual_domains table on
different postfix server and set it as primary (and only) MX.

Unfortunately now more and more users have started emailing
[hidden email] but I don't have user records and the emails are being
rejected.
Since I want to make clear mydomain.net will NEVER work for emailing
purposes, I though of implementing a custom bounce (and I mean bounce,
not reject), something like "There is no such user on this server: use
[hidden email] instead".
To make things more tricky, a couple users actually exist on the server
and mail to those addresses shouldn't be bounced.

I thought of setting up a catch-all address (I user postfix with mysql
tables) and piping it through an auto-responder, but that seems
unnecessarily complicated to me.
Is there any feature in postfix that allows me to send custom bounce for
any address in the domain except those that are in the users' table?

Thanks,

Andrea

Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

Ralf Hildebrandt
* Andrea Gozzi <[hidden email]>:

> Unfortunately now more and more users have started emailing
> [hidden email] but I don't have user records and the emails are being
> rejected.

Use relocated_maps

--
Ralf Hildebrandt ([hidden email])          [hidden email]
Postfix - Einrichtung, Betrieb und Wartung       Tel. +49 (0)30-450 570-155
http://www.arschkrebs.de
It's mathematical: (uNsTable - NT) = usable.
Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

Wietse Venema
In reply to this post by Andrea Gozzi-2
Andrea Gozzi:

> Hi.
> I currently run a website, mydomain.com, and there are a bunch of email
> users so I have a postfix installation taking care of it.
> This is all running on a housed server thousand of miles away from my
> workplace.
> A couple months ago I purchased mydomain.net and set up a redirect
> towards mydomain.com, so all http requests were taken care of.
> Since I wasn't expecting any mail to @mydomain.net I didn't bother much
> about it. I just added an entry in the virtual_domains table on
> different postfix server and set it as primary (and only) MX.
>
> Unfortunately now more and more users have started emailing
> [hidden email] but I don't have user records and the emails are being
> rejected.
> Since I want to make clear mydomain.net will NEVER work for emailing
> purposes, I though of implementing a custom bounce (and I mean bounce,
> not reject), something like "There is no such user on this server: use
> [hidden email] instead".
> To make things more tricky, a couple users actually exist on the server
> and mail to those addresses shouldn't be bounced.
>
> I thought of setting up a catch-all address (I user postfix with mysql
> tables) and piping it through an auto-responder, but that seems
> unnecessarily complicated to me.
> Is there any feature in postfix that allows me to send custom bounce for
> any address in the domain except those that are in the users' table?

Use a transport map.

/etc/postfix/main.cf:
    transport_maps = hash:/etc/postfix/transport

/etc/postfix/transport:
    example.com     error:5.1.1 User unknown use [hidden email] instead.

References:
http://www.postfix.org/transport.5.html
http://www.postfix.org/error.8.html

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

Andrea Gozzi-2
On Thu, 2008-06-26 at 10:16 -0400, Wietse Venema wrote:
> Andrea Gozzi:
> Use a transport map.
>
> /etc/postfix/main.cf:
>     transport_maps = hash:/etc/postfix/transport
>
> /etc/postfix/transport:
>     example.com     error:5.1.1 User unknown use [hidden email] instead.

Thanks Wietse.
I tried what you suggested, but now I get bounces for any
'[hidden email]' , including the legitimate ones.


> Andrea Gozzi:
> > To make things more tricky, a couple users actually exist on the server
> > and mail to those addresses shouldn't be bounced.


Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

Charles Marcus
In reply to this post by Andrea Gozzi-2
On 6/26/2008, Andrea Gozzi ([hidden email]) wrote:
>>> Since I want to make clear mydomain.net will NEVER work for emailing
>>> purposes, I though of implementing a custom bounce (and I mean bounce,
>>> not reject), something like "There is no such user on this server: use
>>> [hidden email] instead".

>> Use a transport map.
>>
>> /etc/postfix/main.cf:
>>     transport_maps = hash:/etc/postfix/transport
>>
>> /etc/postfix/transport:
>>     example.com     error:5.1.1 User unknown use [hidden email] instead.

> Thanks Wietse.
> I tried what you suggested, but now I get bounces for any
> '[hidden email]' , including the legitimate ones.

Ummm... look at your initial message. You said that there were NO valid
recipients at the .net domain... so which is it?

If there are NONE, then Wietse's way is best I'm sure...

Otherwise, you could use relocated_maps as Ralf suggested...

--

Best regards,

Charles
Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

Benny Pedersen
In reply to this post by Andrea Gozzi-2

On Thu, June 26, 2008 16:02, Andrea Gozzi wrote:

> I thought of setting up a catch-all address (I user postfix with mysql
> tables) and piping it through an auto-responder, but that seems
> unnecessarily complicated to me.
> Is there any feature in postfix that allows me to send custom bounce for
> any address in the domain except those that are in the users' table?

why not add spf ? (mydomain.xxx. IN TXT "v=spf1 ~all")

this spf record implies that no mail will be authed from this domain

and use pypolicyd-spf on both servers ?

dont do the catch all spam trick

--
Benny Pedersen
Need more webspace ? http://www.servage.net/?coupon=cust37098
Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

mouss-2
Benny Pedersen wrote:

> On Thu, June 26, 2008 16:02, Andrea Gozzi wrote:
>
>  
>> I thought of setting up a catch-all address (I user postfix with mysql
>> tables) and piping it through an auto-responder, but that seems
>> unnecessarily complicated to me.
>> Is there any feature in postfix that allows me to send custom bounce for
>> any address in the domain except those that are in the users' table?
>>    
>
> why not add spf ? (mydomain.xxx. IN TXT "v=spf1 ~all")
>
> this spf record implies that no mail will be authed from this domain
>
> and use pypolicyd-spf on both servers ?
>
> dont do the catch all spam trick
>
>  

please reread OP message. this has nothing to do with "senders". he
wants to accept few recipients but reject others with a custom message
(relocated like). so SPF is completely out of topic.


Please do not try to start SPF propaganda on this list. it is taboo here
(search the archives). the subject has already been debated, and it's
good to keep peace between us.
Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

Wietse Venema
In reply to this post by Andrea Gozzi-2
Andrea Gozzi:
[ Charset UTF-8 unsupported, converting... ]

> On Thu, 2008-06-26 at 10:16 -0400, Wietse Venema wrote:
> > Andrea Gozzi:
> > Use a transport map.
> >
> > /etc/postfix/main.cf:
> >     transport_maps = hash:/etc/postfix/transport
> >
> > /etc/postfix/transport:
> >     example.com     error:5.1.1 User unknown use [hidden email] instead.
>
> Thanks Wietse.
> I tried what you suggested, but now I get bounces for any
> '[hidden email]' , including the legitimate ones.

Right. you wrote "there are no users" on the domain so that's
what the solution provides.

If some users do exist (contrary to what you wrote), you need:

/etc/postfix/transport:
    [hidden email]     ::
    [hidden email]     ::
    example.com     error:5.1.1 User unknown use [hidden email] instead.

        Wietse

> ?
> > Andrea Gozzi:
> > > To make things more tricky, a couple users actually exist on the server
> > > and mail to those addresses shouldn't be bounced.
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Custom bounce message

Andrea Gozzi-2
On Thu, 2008-06-26 at 14:44 -0400, Wietse Venema wrote:
> Andrea Gozzi:
> [ Charset UTF-8 unsupported, converting... ]
> > On Thu, 2008-06-26 at 10:16 -0400, Wietse Venema wrote:
> /etc/postfix/transport:
>     [hidden email]     ::
>     [hidden email]     ::
>     example.com     error:5.1.1 User unknown use [hidden email] instead.
>
> Wietse

Thanks Wietse, it woeks great.
Sorry for the misunderstanding :)

Andrea