Where Did My Brain Go?

Quick Mail 4.0.5 Blocks Domains

Discover the latest version of Quick Mail.

Quick Mail is the easiest way to send email with attachments to WordPress users on your site, or send private replies to comments. Compatible with multisite. Includes WP-CLI command.

I created Quick Mail in 2014. Quick Mail 4.0.5 is the 46th release on Github.

Quick Mail 4.0.5 Reverses a Trend

I started removing Quick Mail restrictions in 2019.

Quick Mail 3.5.2 added the all option to the WP-CLI command. Because I wanted to send email to everyone on a WordPress site.

Quick Mail 4.0.1 was also kinder and gentler. Because I added a filter to allow non-administrators to send mail with WP-CLI.

But every system needs checks and balances.

Quick Mail is Ready for 2021

My latest Quick Mail release finally lets administrators block users from sending mail to selected domains.

Banhammer Time!

Quick Mail includes a new option for “Banned Addresses” — shown above.

Enter a domain or email address. Separate each with a space or a carriage return. Quick Mail and sanitize_text_field() format your entry.

For example: person@usa.mail.example.com is saved as example.com.

Note: Domains are only checked once. They are not checked again, when a new domain is added.

New error message: Invalid or blocked mail address.

If address validation is “Off” users see “Invalid or blocked mail address” after they try to send email to a blocked domain.

Otherwise: if address validation is “On” users see the same “Cannot Verify Address” message, if they try to send email to a blocked domain.

New WP-CLI error message: Blocked recipient address

Let’s send sitemap.xml to fred@example.com.

wp quick-mail 1 fred@example.com sitemap.xml

If an administrator blocked example.com, user sees:

Blocked recipient address: fred@example.com

Quick Mail always rejects banned domains, even if you are not validating addresses. Because the WP-CLI program tests for banned domains before checking the verify domain setting.

How Do Banned Domains Work?

The action starts after you enter a recipient’s email address. After you press <Tab> or <Enter> jQuery intercepts your keystroke, for additional processing.

Quick Mail uses a custom AJAX endpoint to compare the address with Banned Domains saved in the WordPress database.

Where’s the Nonce?

My AJAX routine encrypts the domain, like a password. It sends both values. The processing function compares the two values.

Quick Mail 4.0.5 sends a Status 204 – No content response, if the values are different.

Example of Checking Domain

How to use Quick Mail to check for a banned domain from standalone Web page.

QuickMailUtil::acceptable_domain($domain) returns an empty string for blocked domains. Easy!

But I Want to Block Domains with WP-CLI

That is a great idea!

I would like to add wp quick-mail ban example.com to Quick Mail 4.1.0.

Quick Mail Support

Please use Github issues for support. Quick Mail has no open issues or bug reports.

No Github Account? No Problem!

Leave me a comment with your Quick Mail 4.0.5 question at the end of this article.

Quick Mail Support on WordPress received less than 20 questions in five years.

Get Quick Mail from Github

Download Quick Mail 4.0.5 from Github.

I tested Quick Mail 4.0.5 with WordPress 5.6.

Please refer to my previous articles on Quick Mail for additional information.

I hope Quick Mail improves your WordPress experience and your life :)