API to discard message with email Filter
Is there an API function to Discard Message with an email filter?
In cPanel > Email Filters, the first option in the Action dropdown is Discard Message.
However, I don't see that option in the UAPI - Email::store_filter.
I see that there's an option for "fail", however my understanding is that will send out a bounceback to the sender. I'm worried if I use "fail" and the email addresses get excessively spammed, my email server could get backed up with sending out bouncebacks. Perhaps I'm misunderstanding how that works though.
Thanks!
-
Hey @hiredgeek , The webmail interface is using /dev/null
.0 -
Thanks TJ, that makes sense. Is that the best way to handle incoming email that is unwanted? For instance, I am using a noreply@ mail account to send using SMTP, and I don't want any replies, and bouncebacks are unnecessary. Is setting the destination to /dev/null the same as a blackhole? I see alot of different opinions about whether to blackhole or fail, and some of it is outdated. What do you advise in 2020? 0 -
Hi @hiredgeek So the only instances in which I'd recommend you save to /dev/null (silently fail or discard the message) is if you don't want to send a bounceback i.e., it's obvious spam or domain forgery and sending a bounceback would result in backscatter. In other instances though, the RFC compliant way to manage delivery failures is to fail it with a message so the sender knows why the message failed to be delivered. There is a fantastic and very informative discussion of this here: 0 -
Thank you Lauren and @sparek-3. It sounds like for my scenario, what I should use is a Forwarder (not a filter). And select the option to "Discard with error to sender (at SMTP time)", so that the remote server is the one sending the message. I would use UAPI Function - Email::add_forwarder, and fwdopt=fail. And then my server would not be receiving and handling the messages, correct? 0
Please sign in to leave a comment.
Comments
4 comments