On Mon, 21 Sep 2020, Koga Hayashi wrote:
Dan,
-----Original Message-----
From: [email protected] <[email protected]> On
Behalf Of Dan Mahoney (Gushi)
Sent: Monday, September 21, 2020 10:29 AM
To: [email protected]
Subject: Custom reject message for one address?
Hey there all,
At the dayjob, we're getting enough spam to webmaster@ that we've decided to
reroute it to a different address.
We'd like to have the bounce messgge let people know about this address.
We don't want to send them another message, but we'd like their bounce message
to give them a clue -- IF they read it.
So something like REJECT "Sorry this address has been overrun, please email
[email protected]"
If I just delete the address, I get "user unknown in virtual alias table".
If I try putting the reject in my virtual alias, this seems not to be parsed at
that
point in the process.
How can one do this?
If my understandings are collect, steps below should do the trick.
1. Create a mapping file like below
/etc/postfix/custom_reject:
[email protected] REJECT Sorry this address has been overrun,
please email [email protected]
2. sudo postmap /etc/postfix/custom_reject
3. Edit the main.cf like below.
smtpd_recipient_restrictions:
check_recipient_access hash:/etc/postfix/custom_reject
I have these things in place already. This is also a virtual domain:
# Insert text from sample-virtual.cf if you need virtual domain support.
virtual_maps = hash:$config_directory/delivery_maps/final_delivery_foo,
where [email protected] [email protected]
If I have an entry in the recipient map, the mail goes through to its
final destination and I do not get a bounce.. If I do
not, I get this error:
----- The following addresses had permanent fatal errors -----
<[email protected]>
(reason: 550 5.1.1 <[email protected]>: Recipient address rejected:
User unknown in virtual alias table)
In neither case do I get the error specified in my
whitelist_recipients map:
[email protected] REJECT Sorry this has been abused please
contact [email protected]
Here are the relevant bits of main.cf:
local_recipient_maps =
$relocated_maps,
$alias_maps,
unix:passwd.byname,
$virtual_maps
virtual_maps = hash:$config_directory/delivery_maps/final_delivery_foo,
hash:$config_directory/delivery_maps/mail2news,
regexp:$config_directory/delivery_maps/regex_aliases
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unknown_sender_domain,
reject_unknown_recipient_domain,
reject_unauth_destination,
reject_invalid_hostname,
reject_non_fqdn_hostname,
check_client_access cidr:$config_directory/access/spammers,
check_client_access cidr:$config_directory/access/whitelist,
check_sender_access hash:$config_directory/access/sender_access,
check_recipient_access
hash:$config_directory/access/whitelist_recipients,
reject_rbl_client zen.spamhaus.org
4. reload postfix
Kouga
-Dan
--
--------Dan Mahoney--------
Techie, Sysadmin, WebGeek
Gushi on efnet/undernet IRC
FB: fb.com/DanielMahoneyIV
LI: linkedin.com/in/gushi
Site: http://www.gushi.org
---------------------------
--
"Blargy Frap!"
-mtreal, efnet #macintosh channel, 8.10.98, Approx 3AM
--------Dan Mahoney--------
Techie, Sysadmin, WebGeek
Gushi on efnet/undernet IRC
FB: fb.com/DanielMahoneyIV
LI: linkedin.com/in/gushi
Site: http://www.gushi.org
---------------------------