Global Filter- Fail with Message filter not working properly
Hello i am trying to avoid emails from certain people. I want the server to reject the email and tell the unwanted sender something like "mailbox full blah blah".
I tried using the global filter from cpanel "Email Filters" > Create new filter
Rules: From > contains > temp@abc.com
Actions: Fail with Message "Mailbox is full / Blocks limit exceeded / Inode limit exceeded"
it works on my me@abc.com i do not receive te email and temp@abc.com gets the error message.
However the problem is when i tested this filter with a gmail or Hotmail or even a cpanel domain the fail message is not received(by the sender) on gmail or Hotmail or whatever domain other than my own.
Conclusion: Fail message is not being received(by the sender) when an filtered email from another domain is sent to me.
Help :(
-
i cannot comment why you don't see the fail message. But 'contains' is probably not the right way to go. Many words could contain temp@, maybe equals would be a better option if you wish to block a particular email address. 0 -
HI @Salman Arshad I tested this the way you have it configured with my Gmail account and found that I did in fact receive the failed message but it was sent to spam when it was received. 0 -
HI @Salman Arshad I tested this the way you have it configured with my Gmail account and found that I did in fact receive the failed message but it was sent to spam when it was received.
I tried everything but it does not work :( not even in spam/trash or junk. there is also an option in horde filters but when I try to choose the action it does not give the option in the drop down "reject with message" any way to use that?0 -
Hi @Salman Arshad For me contains worked also I got it to function using equals but you need to consider the entire "From" line when using equals. For example when I send mail from my Gmail account to my test server my "From" line is not just my email address: From: Lauren Date: Wed, 11 Jul 2018 09:28:35 -0500 Message-ID: Subject: another test To: test@mydomain.tld
In order for this to work as equals you'll need to add that entire from line:[root@server test]# cat filter # Exim filter - auto-generated by cPanel. # # Do not manually edit this file; instead, use cPanel APIs to manipulate # email filters. MANUAL CHANGES TO THIS FILE WILL BE OVERWRITTEN. # headers charset "UTF-8" if not first_delivery and error_message then finish endif #test if $header_from: is "Lauren " then if error_message then save "/dev/null" 660 else fail "Test Fail" endif endif
I can also get this to work for contains which is going to just ensure that the string "myemail@gmail.com" exists in the header in the "From" section.[root@server test]# cat filter # Exim filter - auto-generated by cPanel. # # Do not manually edit this file; instead, use cPanel APIs to manipulate # email filters. MANUAL CHANGES TO THIS FILE WILL BE OVERWRITTEN. # headers charset "UTF-8" if not first_delivery and error_message then finish endif #test if $header_from: contains "myemail@gmail.com" then if error_message then save "/dev/null" 660 else fail "Test Fail" endif endif
I've confirmed multiple times at this point that the filter does indeed work, if it's not working for you, you may need to rule out other factors such as other filters or configurations. The mail transaction at /var/log/exim_mainlog will show you when it's working as well - most importantly this line:2018-07-11 14:36:38 1fdGEQ-0002vE-6z ** test@mydomain.tld R=virtual_user_filter: Test Fail
Thanks!0 -
I really don't recommend using fail in filters. This is really a horrible idea that I wish cPanel would remove. If someone sends an email from [plain]idontexist@example1.tld[/plain] to [plain]imafilteredaddress@example2.tld[/plain] and it hits a filter that fails the message, then the mail server handling mail for example2.tld is going to try to send a failed email message back to [plain]idontexist@example1.tld[/plain] but it's not going to go anywhere because [plain]idontexist@example1.tld[/plain] ... doesn't exist. Set up an example1.tld account on one server, don't create any email addresses and leave the default address as :fail: on that account. Set up an example2.tld account on another server. Create a filter that matches a subject of "fail me" and set it to fail the message. Set up an email account on example2.tld - [plain]imafilteredaddress@example2.tld[/plain] Now send a message from [plain]idontexist@example1.tld[/plain] with the subject "fail me" to [plain]imafilteredaddress@example2.tld[/plain]. [plain]imafilteredaddress@example2.tld[/plain] won't get the message. But [plain]idontexist@example1.tld[/plain] won't get a failed message back. In fact, if you review the mail queue on the example2.tld server, you'll find that failed message stuck in queue waiting to be sent to [plain]idontexist@example1.tld[/plain] but it never will because it doesn't exist. You can't use :fail: on messages that have already been accepted by the server. :fail: works in the default address because the message is never accepted by the server. When doing an SMTP transaction and you leave that "." on a line by itself... the message fails if the recipient does not exist and the account's default address is set to :fail: ... the server never accepts it. 0
Please sign in to leave a comment.
Comments
5 comments