Koozali.org: home of the SME Server

Block Email from Domain

Offline Bud

  • *
  • 487
  • +0/-0
Block Email from Domain
« on: October 27, 2016, 01:58:09 PM »
guys please help

i need to block email received from a certain domain being sent to users on my sme 9.1 server

eg: Somebody from Domain x somebody@domainx.com is sending mail to my user(s) on my sme 9.1 server user1@mysmeserver.com

i need to blacklist the domainx.com so that NO email will be delivered to my sme 9.1 server

how do i do this?

guest22


Offline Bud

  • *
  • 487
  • +0/-0
Re: Block Email from Domain
« Reply #2 on: October 27, 2016, 02:34:08 PM »
RequestedDeletion thank you for your help. much appreciated  :D

how can i check to whom somebody@domainx.com has sent mail to my users on my sme 9.1 server

any help greatly appreciated  :)

guest22

Re: Block Email from Domain
« Reply #3 on: October 27, 2016, 02:40:38 PM »
Logfiles? e.g. qsmtpd logs?

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Block Email from Domain
« Reply #4 on: October 27, 2016, 03:09:32 PM »
something like

Code: [Select]
grep logterse /var/log/qpsmtpd/current | grep  'domainx.com' | tai64nlocal

should do the trick
« Last Edit: October 27, 2016, 03:11:10 PM by Stefano »

Offline Bud

  • *
  • 487
  • +0/-0
Re: Block Email from Domain
« Reply #5 on: October 28, 2016, 10:51:41 AM »
RequestedDeletion and stefano thank you for your input much appreciated

i have installed the https://wiki.contribs.org/Email_Whitelist-Blacklist_Control contrib and have done the following as a test on my sme 9.1 server

server-manager > E-mail WBL > Black List

i placed an entry in qpsmtpd badhelo " somebody@domainx.com " ( without the inverted commas )
i placed an entry in  qmail badmailfrom " somebody@domainx.com " ( without the inverted commas )
i have placed an entry in spamassassin blacklist_from " somebody@domainx.com " ( without the inverted commas )

i then did a test using

the email is NOT blacklisted and still goes to the users mailbox ie the email is NOT being rejected.

i require the email from somebody@domainx.com to NOT be delivered to any user on the sme 9.1 server

any ideas what i am doing wrong  :D

guest22

Re: Block Email from Domain
« Reply #6 on: October 28, 2016, 11:17:55 AM »
Did you do a signal-event post-upgrade; signal-event reboot after installing the contrib? And is your server fully updated?

Offline warren

  • *
  • 293
  • +0/-0
Re: Block Email from Domain
« Reply #7 on: October 28, 2016, 11:50:46 AM »
RequestedDeletion and stefano thank you for your input much appreciated

i have installed the https://wiki.contribs.org/Email_Whitelist-Blacklist_Control contrib and have done the following as a test on my sme 9.1 server

server-manager > E-mail WBL > Black List

i placed an entry in qpsmtpd badhelo " somebody@domainx.com " ( without the inverted commas )
i placed an entry in  qmail badmailfrom " somebody@domainx.com " ( without the inverted commas )
i have placed an entry in spamassassin blacklist_from " somebody@domainx.com " ( without the inverted commas )

i then did a test using

the email is NOT blacklisted and still goes to the users mailbox ie the email is NOT being rejected.

i require the email from somebody@domainx.com to NOT be delivered to any user on the sme 9.1 server

any ideas what i am doing wrong  :D

How did you do the testing ?

Is the email address you want to block in the list when you do :
Code: [Select]
cat /var/qmail/control/badmailfrom
what does this show :
Code: [Select]
grep logterse /var/log/qpsmtpd/current | grep  'check_badmailfrom' | tai64nlocal
On several servers i manage i see this when blocking a sender :

Code: [Select]
2016-10-28 11:37:22.210612500 4542 logging::logterse plugin (deny): ` 209.85.220.181    mail-qk0-f181.google.com        mail-qk0-f181.google.com       <XXXX@gmail.com>             check_badmailfrom       901     sorry, your envelope sender is in my badmailfrom list   msg denied before queued

Offline Bud

  • *
  • 487
  • +0/-0
Re: Block Email from Domain [ SOLVED ]
« Reply #8 on: November 01, 2016, 08:59:51 PM »
thank you to all that helped me  :)

much appreciated