OK - following on from some other threads here, here's a quicky on how to block specific mails using the BadMailFromTo plugin.
There is no warranty with this. It MAY have unintended consequences so beware !!A typical example we have is where several companies belong to a 'group' and use a shared newsletter hoster eg emailgun or similar
When you receive a mail it will have a line like this
dispatching MAIL FROM:<bounce+c3f563.7fcf54-user=ourdomain.co.uk@someservice.com>
BUT.
The 'From' line showing in the mail client will be say:
sales@someprintingcompany.com
We could block someservice.com entirely but we do want some emails, just not all.
Here's how to block it on the 'From' address you can see in the email client.
Note that I am using templates-custom + one config entry.
nano /etc/e-smith/templates-custom/var/service/qpsmtpd/config/plugins/31badmailfromto
Paste this:
{
return "# BadMailFromTo disabled" unless (${qpsmtpd}{BadMailFromTo} eq "enabled");
"badmailfromto";
}
And save.
Next:
cd /etc/e-smith/templates-custom/var/service/qpsmtpd/config/peers/0
ln -s ../../plugins/31badmailfromto 31badmailfromto
Data goes in this file. Note the From and To must be tab separated:
nano /var/service/qpsmtpd/config/badmailfromto
Use this format where <tab> means insert a TAB with the tab key !
From<tab>To
mytestaccount@gmail.com<tab>user@mydomain.co.uk
Now we need to fire it all up:
config setprop qpsmtpd BadMailFromTo enabled
signal-event email-update
Try a test mail from the gmail account.
** Message not delivered **
There was a problem delivering your message to user@mydomain.co.uk. See the technical details below.
The response from the remote server was:
550 mail to user@mydomain.co.uk not accepted here
Fabulous !!
To disable set BadMailFromTo <> enabled and email-update.
I might see if I can add a little DB to add addresses and formats the /var/service/qpsmtpd/config/badmailfromto file properly.