Block outgoing email for a Direct Admin user

cPanel has a mechanism to completely suspend outgoing email for an account, which is useful when there’s a bunch of spamming going on. Particularly contact form spam when the admin of a site can’t or won’t disable or secure the form.

 root@host [~]# whmapi1 suspend_outgoing_email user=spamalot
   command: suspend_outgoing_email
   reason: OK
   result: 1
   version: 1

I have a stupid Joomla site that I keep around mostly to have a “stock” Joomla for comparison purposes. Everyone knows Joomla has a frequently abused contact form, so I don’t want this Direct Admin account to be able to send out email at all.

It’s possible to suspend outgoing email for an entire DA account. Log in as the admin user on the admin level, then go to

Dashboard -> Server Manager -> Adminstrator Settings -> Email Settings (tab)

You’ll see “ADD TO BLACKLIST” at the bottom. Click that, then enter in the DA username. Click “Add”

Save, then you’ll see the DA user has been blacklisted from sending email.

Try to send an email from the Joomla contact form and click the checkbox to send yourself a copy, this is what’ll be in the email log.

2021-02-27 18:19:55 1lG9oR-0003T6-My => blackhole (non-SMTP ACL discarded recipients): User account (crack) is not allowed to send emails.  Script delivery blocked via /etc/virtual/blacklist_usernames

And there’s the user in this blacklist:

[root@miss]# cat /etc/virtual/blacklist_usernames

That number string is just the UNIX timestamp.