Koozali.org: home of the SME Server

How to reject a specific email address

Offline brianr

  • *
  • 988
  • +2/-0
How to reject a specific email address
« on: September 15, 2017, 03:02:48 PM »
A client of mine is using the email server in a "catchall" mode for reasons of his own.

However he / we want to specifically exclude email sent to a specific email address in his domain.

What is the best way to do it?

Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline brianr

  • *
  • 988
  • +2/-0
Re: How to reject a specific email address
« Reply #1 on: September 16, 2017, 06:04:34 PM »
Looks like I need to use:badrcptto (qpsmtpd plugin)

So I need to edit

/var/service/qpsmtpd/config/badrcptto

Which is templated.

However the contents and anything else I can find does not help me with the format.

It contains:

Code: [Select]
<usual templage header>
! Sorry, bang paths not accepted here
@.*@ Sorry, multiple at signs not accepted here
^@         Invalid recipient address
% Sorry, percent hack not accepted here
# Format is pattern\s+Response - don't forget to tie the pattern if required




Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: How to reject a specific email address
« Reply #2 on: September 17, 2017, 12:51:30 AM »
It looks to me like the existing templates for 'badrcptto' don't include any way for you to add content other than through with a custom fragment.

I'm guessing, but I think the code below will deny mail from both 'user@server.com', and 'anotheruser@anotherserver.com', and will deny email from 'anotheruser@anotherserver.com' with an SMTP error code of "Buzz Off!"

Code: [Select]
mkdir -p /etc/e-smith/templates-custom/var/service/qpsmtpd/config/badrcptto
cd /etc/e-smith/templates-custom/var/service/qpsmtpd/config/badrcptto
echo 'user@server.com
anotheruser@anotherserver.com Buzz Off!'> 20DenyMailFrom
signal-event email-update

Offline brianr

  • *
  • 988
  • +2/-0
Re: How to reject a specific email address
« Reply #3 on: September 17, 2017, 08:15:09 AM »
It looks to me like the existing templates for 'badrcptto' don't include any way for you to add content other than through with a custom fragment.

I'm guessing, but I think the code below will deny mail from both 'user@server.com', and 'anotheruser@anotherserver.com', and will deny email from 'anotheruser@anotherserver.com' with an SMTP error code of "Buzz Off!"

Code: [Select]
mkdir -p /etc/e-smith/templates-custom/var/service/qpsmtpd/config/badrcptto
cd /etc/e-smith/templates-custom/var/service/qpsmtpd/config/badrcptto
echo 'user@server.com
anotheruser@anotherserver.com Buzz Off!'> 20DenyMailFrom
signal-event email-update

ok, I was not sure what the "response" bit was - but I see now  - thanks.

However I am looking for something to reject email sent TO a particular email address - I think that is probably what you mean - but I'd like it confirmed before I start hacking the server.
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: How to reject a specific email address
« Reply #4 on: September 17, 2017, 02:41:54 PM »
Yes, you're right; sorry.

badrpctto blocks email going *to* the emails in /var/service/qpsmtpd/config/badrpctto

Quote from: perldoc /usr/share/qpsmtpd/plugins/badrcptto
SYNOPSIS
       deny connections to recipients in the badrcptto file

       like badmailfrom, but for recipient address rather than sender


Depending on what you've done to convince the SME server to accept email to any recipient, you might simply need to create a user account for the email address you *don't* want in the catch-all, then set up that account to delete or forward whatever it receives.

Offline brianr

  • *
  • 988
  • +2/-0
Re: How to reject a specific email address
« Reply #5 on: September 17, 2017, 05:47:34 PM »
Depending on what you've done to convince the SME server to accept email to any recipient, you might simply need to create a user account for the email address you *don't* want in the catch-all, then set up that account to delete or forward whatever it receives.

That actually makes the most sense - many thanks!
Brian j Read
(retired, for a second time, still got 2 installations though)
The instrument I am playing is my favourite Melodeon.
.........

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: How to reject a specific email address
« Reply #6 on: September 17, 2017, 06:57:00 PM »
brianr

There is a db command to control user or group external visibility. I am not sure if you are trying to block a user who is in the catch all setup, so the command may or may not be what you want. I think you need to provide more details & tell us how the catch all is set up.

From the FAQ - Email (link at top of Forums)
db accounts setprop groupname/username Visible internal signal-event email-update
(replace groupname/username)
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.