Where Did My Brain Go?

Quick Mail 4.0.6 Maintenance Release

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.6 is the 47th release on Github.

Quick Mail 4.0.6 Updates

I use Quick Mail validation in other plugins. For example, I use banned domains to block email addresses in two other plugins.

It is easy to create a special link, known as a custom AJAX endpoint to communicate with WordPress from JavaScript.

So I use a JavaScript function that calls WordPress action to query the database.

I Replaced file_get_contents with cURL

But Quick Mail 4.0.5 used file_get_contents to send this POST request to WordPress. According to PHP manual:

file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance.

However, this was a bad idea. Because file_get_contents() needs fopen wrappers to read URL. Some some security minded administrators disabled this setting.

Note: The Quick Mail WP-CLI Command still uses file_get_contents() to load remote files.

What is cURL?

cURL is two products that transfer data between computers.

  1. Command line program that is available on many systems.
  2. Library of functions for programmers.

Daniel Stemberg released cURL in 1998.

cURL is used in many products, including ATM machines. If you would like to learn more about cURL, watch Using cURL better – with cURL Creator Daniel Stenberg.

Quick Mail 4.0.6 Requires cURL

Although WordPress recommends cURL, it is not required.

However, Quick Mail 4.0.6 checks for cURL on installation.

Additionally, users see a new message if cURL is not found: “Quick Mail requires cURL extension.”

Validating International Domains

Finally, we reached the biggest error fix in the history of Quick Mail.

Quick Mail has supported international domains since 2016.

It started with a project for Ronald L. McDonald. Ron asked me to add a list of domains to a Web site. Of course, I checked the domains. However, some of Ron’s domains had accented characters.

Ron’s project introduced me to Punycode. Programmers wrote the domain name system for English domains. Punycode removes “foreign” characters from domain names.

For example, ‘mérens.club’ = ‘xn--mrens-bsa.club’ in Punycode.

I added this feature to Quick Mail after Ron’s project.

But it stopped working on Quick Mail 4.0.5.

First of all, I added cURL because file_get_contents() is blocked on some servers. But after I fixed that problem, idn_to_ascii() seemed to change its behavior.

The Big Fix

For some reason, idn_to_ascii() returned a single character on a test site.

Documentation says idn_to_ascii returns:

The domain name encoded in ASCII-compatible form, or false on failure.

“ASCII-compatible form” is the ACE format. Domain names start with “xn--”.

The ASCII-compatible encoded (ACE) representation of an internationalized domain name, i.e. how it is transmitted internally within the DNS protocol. A-labels always commence with the prefix "xn--". — IDN Glossary

So Quick Mail 4.0.6 only accepts the converted name, if it starts with xn--.

In short, it works.

Design Improvement

Obviously, I need a better method of testing Quick Mail 4.0.6 — and future versions.

Carl Alexander discussed testing in Singletons and their use in WordPress. I followed Mr. Alexander’s advice. The WordPress initialization functions were moved from the class constructor to a static function.

I can finally create a new class for testing, without loading WordPress actions and filters.

Without a doubt, all software has bugs. But everyone needs more reliable software.

Quick Mail 4.0.6 Support

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

No Github Account? No Problem!

Leave me a comment with your Quick Mail 4.0.6 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.6 from Github.

I tested Quick Mail 4.0.6 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 :)