Where Did My Brain Go?

Quick Mail 3.2.3 Sends Reliable Email from WordPress

Discover the latest version of Quick Mail.

I released Quick Mail 3.2.3 on August 23, 2017.

Tougher security requirements make it harder to send email from a Web site.

I had emails sent by Quick Mail, rejected by Gmail.

Quick Mail did not recognize a problem. I found Google’s error message buried in an email sent to the fictitious user running the Web server.

I needed to send secure emails ASAP.

The SendGrid Email Delivery Service was more familiar, so I used it first. SendGrid installed in minutes and worked perfectly.

SendGrid is not free. I tested it using a free trial account.

Mailgun is also familar.

Mailgun is free, works perfectly, but takes longer to install. You must verify your domain to send mail, and wait for the DNS changes to propagate.

Note: I am not affiliated with Mailgun or SendGrid, but I have used them on jobs.

Quick Mail 3.2.3 Includes WP-CLI Command

I added a WP-CLI command to send emails with attachments from the command line.

Seriously, I thought it would be cute to send a resume and cover letter from the command line with Quick Mail. I also read an article about tracking certain conditions on Linux, and I wanted to try sending some notifications with Quick Mail.

Finally, Quick Mail 3.2.3 adds the ability to email the contents of a file or Webpage with the quick-mail command for WP-CLI.

Using Quick Mail 3.2.3 with Mailgun

Send authenticated emails with Quick Mail 3.2.3 and the Mailgun API.

Take your time, following the instructions.

  1. Open an account.
  2. Verify your domain. Use the domain that will send emails, for best results. It can take up to a day for your domain to be verified.
  3. Install Mailgun Plugin.
  4. From Mailgun Plugin Settings:
    • Set Use HTTP API to “Yes.”
    • Select “Test Configuration” to verify settings.

Override “From” Details

The Mailgun plugin includes an option to replace the sender address.

This is confusing, if the sender is not the person who installed the plugin.

Quick Mail 3.2.3 circumvents this option, if the user is not an administrator.

I asked Mailgun to allow users to disable this feature, but I have not received a reply.

Mailgun Errors

Quick Mail 3.2.3 will report a Mailgun error.

Avoid errors by selecting “Test Configuration” on the plugin settings page, before sending mail.

Using Quick Mail 3.2.3 with SendGrid

SendGrid is not free.

However, it is the fastest way that I know to setup guaranteed email deliveries from any server — including localhost.

Audrey Capital, the investment branch of WordPress, invested in SendGrid back in 2010. SendGrid works perfectly with WordPress.

  1. Install the SendGrid plugin.
  2. Send a test email from the plugin settings page to verify your settings.
  3. Quick Mail 3.2.3 adds “Use SendGrid credentials” to settings, to replace your sender name and address.
    • Only administrators can replace their sending credentials – same as Mailgun settings. Otherwise users would send mail with the administrator’s settings.

Replacing Quick Mail 3.2.3 Sender

I added replace_quick_mail_sender filter, to use Quick Mail 3.2.3 with other services, or simply to change the sender’s name.

@elvinlee requested this feature last year.

I did not add a setting to change the sender’s name, because it could be abused. However, I wrote a plugin to add this feature.

Download and install Replace Quick Mail Sender plugin from Github to try this.

Alternate Email Sending Options

I tested and reviewed WP Mail SMTP last year. You can use this plugin to send mail from Gmail, Yahoo, Microsoft, etc. Unfortunately, this plugin was sold, and support questions are not answered by the new maintainer.

SMTP Mailer is similar, but supported.

Find additional plugins by searching for SMTP on the WordPress plugin repository.

More Email Delivery Services

PepiPost offers a free API and delivery service.

Install the PepiPost plugin, to use it with WordPress.

Read Top 5 Best WordPress Email Plugins and Platforms for Better Deliverability for more choices.

Send a Web page or file with Quick Mail 3.2.3 and WP-CLI.

I added a WP-CLI command to send a file or Web page from the command line.

wp quick-mail <from> <to> <url or file> [<subject>] [<message_attachment_file>]

The command line is long, but you can use this from a script or batch file.

If you are typing, you can replace sender and recipient email addresses with WordPress user Ids.

I started with URLs, to send the content of Web pages from the command line. Then I added files. Files are just a different type of content. The ability to send files makes the command more useful.

Note: Many email services reject JavaScript attachments, and perhaps others. HTML, PDF, images, text are usually accepted, depending on their size.

Sending Two Files for a Job Application

Did you ever expect to apply to a job from the command line?

You can email your resume (resume.doc) and a cover letter (cover.html) with Quick Mail 3.2.3.

wp quick-mail <from> <to> resume.doc Application cover.html

This sends a message with the subject “Application.” Message is the content of cover.html with resume.doc attached.

For Administrators Only

It seems prudent to limit access to administrators. The sender’s email address must belong to a WordPress administrator.

WP-CLI command line includes a --user option, but I am not checking it.

Sending Web Pages with Quick Mail 3.2.3 and WP-CLI

wp quick-mail <from> <to> <https://example.com/> [<subject>]

wp quick-mail works best for Web sites that have the full path to their stylesheets on their page. Images must be enabled on the recipient’s mail reader, to load external stylesheets and images.

Subject is optional. The title of the Web page will be used for the email, if a subject is not entered.

Notes on Sending Web Pages

http / https
Link must start with http or https, to distinguish it from a file.
Without WP-CLI
Send any Web page, including an unpublished WordPress document, by copying and pasting its code into a “text” message.

Quick Mail will identify the content as HTML. The recipient will see a styled Web page — if their mail reader loads images / stylesheets.

Sending files with Quick Mail 3.2.3 and WP-CLI

wp quick-mail <from> <to> <filename.txt> [<subject>]

Sending a file is like sending a Web page. An additional benefit is that the file can be generated dynamically by a script.

Linux: getting e-mail notification on user login by Samuele Santi, inspired me to write this feature.

Santi’s script uses Mutt, a text-based mailer, to email the output from a bunch of Linux commands, after a user logs in.

You can do the same thing with Quick Mail 3.2.3.

Sending Images / Binary Files

I use mime_content_type to check file content. If content is text/plain or text/html, the contents of the file are the message.

An image, or binary file like a .zip, is sent as an attachment with a generic message: “Please see attached file : filename.doc.”

However, I added an additional option, to change this.

See the example for sending a resume and cover letter.

Default Subject for Files

For Your Eyes Only seemed appropriate.

Add your own subject, to change it.

What’s Next for Quick Mail?

I added Mailgun and SendGrid, before I checked my previous list from Quick Mail 3.1.7.

Quick Mail 3.2.3 has enough features. It should be easier to replace SendGrid. I considered writing an example. I would rather make it easier, in the future.

Quick Mail might need one more option: to limit the number of comments that are loaded. Otherwise, there are too many options, and not enough documentation.

For example, there are six uses of apply_filters. They are now documented in readme.txt, but should probably be in a wiki.

Get Quick Mail 3.2.3 from WordPress or Github

Download Quick Mail 3.2.3 from the WordPress Plugin Repository. Visit Quick Mail on GitHub to add new features.

Quick Mail 3.2.3 was tested with WordPress 4.9, including multisite.

I hope Quick Mail makes your life easier. Please leave a review to help others find it.

Thanks to everyone who has been translating Quick Mail. Please join the translation project so more people can use Quick Mail in their language.

Review my previous articles on Quick Mail for additional information. Download Quick Mail to try it now.