Quick Mail 1.3.0 Supports International Mail
Quick Mail is a WordPress plugin that sends an email with an attachment from the WordPress dashboard.
Quick Mail sends email to a site’s members or to anyone. If the recipient is a WordPress user, their email address is copied from their profile.
Typos are common, so Quick Mail tried to validate the recipient’s domain, if a user entered an email address manually.
It was harder than I thought.
Validating Email Addresses
Quick Mail can validate email addresses with ASCII characters: specifically numbers, hyphens, and English letters.
Unfortunately, neither function handles international email addresses with non-ASCII characters.
Validating Email Domains
If I send an email to an invalid domain with my phone, I will receive a notification in a few seconds or minutes, that my email could not be sent, with a descriptive error message.
However, Quick Mail uses wp_mail, the WordPress mail function to send mail. WordPress says:
A true return value does not automatically mean that the user received the email successfully. It just only means that the method used was able to process the request without any errors.
It seemed to reasonable to test the recipient domain, before sending email. I used checkdnsrr to learn if the recipient’s domain had an MX Record. An MX record tells senders how to send email to a domain.
If a user tried to send email to a domain without an MX record, Quick Mail displayed an “Invalid Email Address” error.
That was wrong for international domain names, with non-ASCII characters.
WordPress removed this feature from is_email, six years ago.
Punycode was created in 2003.
Punycode is a simple and efficient transfer encoding syntax designed for use with Internationalized Domain Names in Applications (IDNA). It uniquely and reversibly transforms a Unicode string into an ASCII string.
For example, “mérens.club” = “xn--mrens-bsa.club” in Punycode.
It is possible that my module was the wrong version. However, I could not fix it. Additionally, I do not expect WordPress users to install PHP extensions to use Quick Mail.
I tested Quick Mail on a different server, with idn_to_ascii and an international email address.
Quick Mail Validation Option
Domain validation is an option in Quick Mail 1.3.0. Use it if your recipients have ASCII email addresses.
I looked at other email address validators, including is_email, but they were also limited to ASCII addresses.
How Does It Work?
Quick Mail 1.3.0 simply checks for an amphora (
'@') and a period, that are not at the beginning or the end of the address. You should know what you are entering. wp_mail also validates the address, before sending mail.
If the recipient’s domain name is in ASCII characters, Quick Mail checks the mail exchanger record on recipient domains, before sending a message. The mail exchanger record or MX, specifies the mail server that accepts messages for a domain.
Send an email to “email@example.com” to test Quick Mail domain validation.
WordPress 4.4 added a helpful hook to wp_mail, for programmers.
wp_mail_failed lets you know why wp_mail did not send a message. I only saw one message while testing Quick Mail.
You must provide at least one recipient email address
This is displayed when the recipient’s email address contains non-ASCII characters.
You should only see this if:
- You entered a manual email address.
- Validate address is off.
- Your address passed a simple check for amphora and period.
- Your version of PHP does not include idn_to_ascii. wp_mail checks for it.
Other International Domain Name Errors
I removed two WordPress functions from Quick Mail: is_email and sanitize_email.
The image above this text, shows results of tests with two WordPress function: is_email and sanitize_email.
test@mérens.club is a valid email address. But is_email rejected it, and sanitize_email changed it.
wp_mail uses PHPMailer to send mail.
PHPMailer also has problems sending email to international domains. See IDN E-mail with username in Unicode is not accepted for more information.
Quick Mail 1.3.0 Requires WordPress 4.4+
WordPress 4.4 is required to see wp_mail errors.
quick_mail_version filter was removed
Dismissible messages were added in WordPress 4.2. Nevertheless, Quick Mail could be used on WordPress 2.9, except dismissible boxes lacked a close button.
I removed this filter, because WordPress 4.4 is required for wp_mail_failed to display a mail error. Mail errors are more important than dismissible boxes.
Get Quick Mail
Quick Mail 1.3.0 was tested with WordPress 4.5.2.
I hope Quick Mail increases your productivity. Please leave a review to help others find it.