How To Post By Email With WordPress

Last Updated on September 20, 2022 by 17 Comments

How To Post By Email With WordPress
Blog / Tips & Tricks / How To Post By Email With WordPress

What if you wanted to post something to your WordPress site, but you didn’t have the time, or you didn’t want to take the time, to go to your site? Easy! Write a blog post in your email and send it to your site. WordPress will post it for you!

Being able to post from email means you can post from anywhere without having to log into your website. You only need access to your email account. This is a great way to publish from a smartphone that doesn’t have the WordPress app installed.

What an amazing feature, right? There are several ways you can post from email. Let’s take a look at how it’s done.

Post via E-mail

How to Use the WordPress Post by Email Feature - Post via E-mail

This is the email feature built into WordPress. To use this you have to set up a secret email account that you send your posts to. Anything that gets sent to that email account gets posted to WordPress. Of course you don’t want anything and everything being posted to WordPress that you or a team member didn’t write, so you’ll have to create an email account that has a high level of privacy. Keep it secret; keep it safe.

To create a secret email, WordPress recommends using random strings in the email address. It gives you three suggestions that are randomly generated. This email needs POP3 access. Anything posted from the email account will be posted in a single category that you set as its default category.

The folks at WordPress feel that this feature is outdated so it will be removed in an upcoming WordPress release. This is now old news and it stills remains intact in the current version. However, it will eventually be removed. When it is, there will still be several methods to make it work. One option is calling the function in code. Another, of course, is plugins. Let’s take a look at our options.

Code

An alternative to calling wp-mail.php directly is to use a method to trigger it. Most of the plugins for posting by mail will do this for you. However, if you still want to do this manually, here is the method that WordPress recommends.

Action Based

You can add an action to you theme’s function.php code that will check for an email every 15 minutes. This code will run when the pages are loaded, so it’s dependent on your site’s traffic. Here’s the code:

add_action( 'shutdown', 'retrieve_post_via_mail' );
function retrieve_post_via_mail() {
	flush(); // Display the page before the mail fetching begins
	if ( get_transient( 'retrieve_post_via_mail' ) ) {
		return; // The mail has been checked recently; don't check again
	} else { // The mail has not been checked in more than 15 minutes
		do_action( 'wp-mail.php' );
		set_transient( 'retrieve_post_via_mail', 1, 15 * MINUTE_IN_SECONDS ); // check again in 15 minutes.
	}
}

You can change the timing by changing the “15” within set_transient to anything you want. If you do, just make sure you change the comments to match (this will help you avoid confusion later – just trust me on this). If you don’t want it to be dependent on your site’s traffic you can use cron jobs.

Cron Jobs

Cron jobs are configured in the server and they run independent of your site’s traffic. First you have to activate the cron job.

UNIX

There are several ways to activate the cron job for UNIX. One way is to use the wget, curl, or GET command from the command line. The code would look like this:

wget -N http://example.com/installdir/wp-mail.php

Substitute wget and its arguments with the program you use.

Another option is to run the php script within a cron job. It would look like this:

php /full/path/to/wp-mail.php

This is probably a better choice as php doesn’t require special authorization to run, where wget probably will.

Windows

If the host is run on Windows you can use a program that is similar to running a cron. Some good choices are:

Each contains documentation on running the cron.

Activating Procmail

If you’re using procmail then you would use .procmailrc in the blogmailaccounts home directory:

Shell=/bin/sh
MAILDIR=$HOME/.maildir/
DEFAULT=$MAILDIR
:0
{
:0Wc
./
:0
| wget -N http://example.com/installdir/wp-mail.php
}

You could even use specific subject expressions if you want. There is more info about this at the procmail site.

Activating .qmail

You can set up servers that use .qmail to call wp-mail.php any time an email is delivered. First you would create a shell-script to call wp-mail.php. The script would look like this:

#!/bin/sh
/bin/sh -c "sleep 5; /path/to/php /path/to/your/blog/wp-mail.php > /dev/null" &

This would go in your root directory, and the execute bit should be set (chmod 700).

Next you need to create the .qmail file to call your shell script. Add this line of code to the .qmail file for your mailbox name:

|/path/to/your/root/directory/wp-mail

Naming conventions will vary from one ISP to another, so you’ll have to consult your ISP’s documentation for more information about .qmail files.

Now, if you don’t want to get into all of that code, you can use a plugin.

Plugins

WordPress recommends that you use a plugin to post from email. They recommend Post by Email, Jetpack, or Postie. Here is a quick look at these plugins and how to use them.

Jetpack

How to Use the WordPress Post by Email Feature - Jetpack

If you’re not using Jetpack, well… you should be using Jetpack. Jetpack is a free suite of plugins from Automattic (those WordPress creators) that has plenty of essential plugins that are lightweight and add value rather than bloat. Among its many tools is a feature to post from a secret email account.

This one creates an email address when you enable the post by email feature (it’s not enabled by default). This is the address you will send your emails to. The address can be changed if you ever need to. Just go back to the button where you enabled the feature and click Regenerate Address. I think it has unlimited regenerations (I always wanted unlimited regenerations).

Developing the post is simple. It uses the subject line as the post title. It will keep as much of the formatting as possible, so you can use HTML if your email client uses rich text or HTML formatting. You can also send plain text if you don’t want to specify any formatting. You can post from any email client. Note – If you’re using a web-based client such as Hotmail or Gmail, or a desktop based system such as Outlook, then you already have a rich text formatting mode.

The post will automatically remove the signatures from clients such as Hotmail and Gmail, and anything after the <hr/> HTML tag for cellphone networks. You can also use a shortcode within your email to remove any unwanted signatures.

There are plenty of other shortcodes that you can embed within your email to format your post. You can use them to:

  • Choose the category
  • Choose tags
  • Set an excerpt
  • Set a more tag
  • Delay the publishing by one hour
  • Turn comments on and off
  • Set the published status (published, pending, or draft)
  • Setup a slideshow
  • Turn the gallery off (the gallery is automatically turned on by default)
  • Set publicize options (it will send notifications to both Facebook and Twitter)
  • Set up a poll for Polldaddy
  • Next page
  • Slug
  • Title (if you want to specify something other than the email title)

You can include images as attachments. A single image will be displayed inline. Multiple images will automatically be set as a gallery unless you provide a shortcode to remove the gallery. This is a superfast way to create a gallery. Simply take a ton of photos and attach them to an email. Done. And easy.

Jetpack is super easy to use, but I have a few issues with it. First, only one address is provided. This is great for one person, but what if you have a team with each member having their own account? This means that every email sent will automatically be labeled as being posted by the administrator.

Second, only one social network can be used with Publicize if you post each network in a separate shortcode. You can send it to both Facebook and Twitter in a single shortcode, but you can’t use separate shortcodes. Why do I care about this? I might want to use templates for my email with shortcodes already posted. This just means I have to use more than one template or I have to include all of the shortcodes and pay close attention to which shortcodes to delete. If I didn’t this would reduce the functionality of Jetpack and take away one of the advantages of Publicize. It’s easy enough to make it work correctly, but it is something to be aware of.

Still, these issues are not enough to keep me from using it. This is a great way to create a full-featured post from your email account. The shortcodes and HTML functions ensure that the posts will look great on your site and not look like you created them in an email.

Postie

How to Use the WordPress Post by Email Feature - Postie

This free plugin gives you lots of advanced features over the current default feature that’s built into WordPress. There are lots of good features that allow you to format your posts including the title, category, status, post type, tags, excerpt, HTML, gallery, comment control, remove headers and footers from the email, etc.

What this one adds are some of the things that are missing in the Jetpack plugin. For one, you can control who gets to post by email. You select which roles are allowed to post. All roles are choices – from administrator all the way to subscriber. You can also tell it which address are authorized to send a post. So if you have more than one person that posts on your site, the post will be labeled with their name. You can allow anyone to post if you want (I seriously have no idea why you would want to do this). For unregistered users you can choose which administrator name you want to use as the default poster. Yeah, I’m not recommending this feature, but it’s there if you want it.

You can set it to automatically take the first image from the post and set it as the featured image. There are templates for images, video, audio files, and other attachments. Email replies become comments.

You can choose how often you want it to check for emails to post. You can choose every 5 minutes, 10 minutes, 30 minutes, hourly, daily, weekly, or only manually.

This one is easy to set up and use, but you do have to set up a lot of options. It’s nowhere near as easy to use as Jetpack, but it has so many more features that it’s worth it. You’ll have to set up your mail protocol (It supports POP3 and IMAP, and you can use SSL or TSL), port, server, ID’s, etc., and then you can make all of your choices for default categories, etc. It has a dashboard where you can make all of your adjustments, too. It is highly customizable.

There are add-ons that expand it even further. Most add-ons are $29 and include:

  • Clean HTML (ensures W3C compliance)
  • Polylang (multiple language support)
  • Geolocation Plus (you add latitude and longitude)
  • Image Only (this one is $5)
  • Open Street Maps (you add a latitude and longitude and it does the rest)

Post by Email

How to Use the WordPress Post by Email Feature - Post by Email

This free plugin is currently in beta and hasn’t been updated in a while, but I installed it on the latest version of WordPress and ran it with no trouble. However, being in beta means you might run into compatibility issues, so run it at your own risk.

You set up an email address to send posts from, and any email it receives from that address gets posted. This is an address you’ll want to keep secret.

It has similar features to what we’ve seen in the previous two plugins:

  • Supports IMAP and POP3, with or without SSL
  • PIN-based authentication guards against email spoofing
  • Uses roles to manage who can post
  • Shortcodes in your email will set categories, tags, and custom taxonomies
  • Attachments are automatically added to the post’s gallery

Any email that it receives from an unauthorized user will be set as pending or you can set them to be discarded if you prefer.

This one is easier to set up than Postie, but only because there are fewer choices to make. It gives you an activity log so you can track attempts to post, etc.

A Couple of Tips

When posting from a secret email account you are running the risk of anyone being able to post to your blog. It is crucial that you keep this email account a highly guarded secret. Only log into this email account on computers you trust. Log out when you’re not using the email.

Use an email template with all of your preferred shortcodes already setup. Then, you only have to update the text and images in order to create a new post.

Wrapping Up

Well, there you have it. Posting to WordPress through email is a handy feature. I can see how this could save lots of time or make it easy to post when you’re away from your favorite computer chair. All three plugins are good choices and posting with them can greatly simplify your posting while on the go.

Your turn! Do you post to your WordPress website through email? Do you have a different method, or have you used a different plugin than what I described here? I’d like to hear your thoughts in the comments below!

Article thumbnail image by Studio_G / shutterstock.com

Divi

Want To Build Better WordPress Websites? Start Here! 👇

Take the first step towards a better website.

Get Started
Divi
Premade Layouts

Check Out These Related Posts

Splice Video Editor: An Overview and Review

Splice Video Editor: An Overview and Review

Updated on March 10, 2023 in Tips & Tricks

Video is a valuable form of content for social media. Unfortunately, creating quality videos is usually a long process that involves moving mobile footage to a desktop app for editing. However, mobile editing is on the rise. Apps such as Splice Video Editor make it possible to efficiently create...

View Full Post
How to Use Font Awesome On Your WordPress Website

How to Use Font Awesome On Your WordPress Website

Updated on September 16, 2022 in Tips & Tricks

When given the choice between using a vector icon or a static image, it’s a good idea to go with the vector. They’re small and fast to load, and they can scale to any size without a loss of resolution. Font Awesome is a superb library of vector icons that you can use on your websites,...

View Full Post

17 Comments

  1. Nice post.

  2. Hey man, this is a good post! I really enjoyed, thank you!

  3. Great plugin, is what I was looking for. I wonder if there is any alternative to associate both post while it outlook / gmail and hotmail so you can synchronize contacts for example. Thank you.

  4. Bloom Plugin is conflicting with my theme named RT-Theme 18.
    When i am activating this plugin then i am not able to edit text in composer.

  5. Why are people on here bitching about Elegant Themes rate of new theme development? Don’t people realize that the blog is just inbound marketing? It has nothing to do with the dev team and everything to do with driving traffic to sell more product. That said, if you can’t afford the nominal fee PER YEAR to maintain your ET subscription, then get a lifetime membership. Or better yet, get out of the web design business. The people who write these blogs aren’t the ones who develop the software, and if you want to call yourself a professional and take other peoples money, then you should already know this, and you should know better. Complaining here is something like crying to the children of your boss because he won’t give you a raise.

    As far as DIVI goes, they can stop producing themes altogether and I would still pay for the subscription annually. I can do anything with DIVI and I’m sure that they will continue to make it better as they compile commonly requested “css hacks” and bug notifications.

    Speaking of “css hacks”, this is programming, and if you can’t take the heat get out of the kitchen. Everything’s a hack if you want to get right down to it. If you have to open a code editor to change the way something works that you didn’t pay 100% of the development costs for, then you are CUSTOMIZING, not hacking. The fact that I can use a child theme and my own style.css file to customize DIVI makes the possibilities endless. If I had a complaint, it’s that their own CSS file is not organized into categories and it’s not documented. It’s difficult to find the elements I need to customize, so I usually just search the forum and either find what I’m looking for, or post my own question and magically, they actually respond and provide css customization recommendations every single time.

    I absolutely love the blog posts that I get from ET and look forward to getting them in my inbox. Having to maintain a couple of blogs and write some published columns myself, I know how difficult and time consuming it is to research, document, and then write technical articles like this one. If you’ve never done it before, try it.

  6. My ET is up for auto-renewal in just a few days. Like some of you, I’m disappointed that the only theme they seem to support is Divi. I have used several of their other ones, and there are endless css hacks required to get a decent looking page, where the content lines up as was obviously intended – or that doesn’t do insanely goofy things (look at the demo for the 13th floor theme and try to click one of the links in the main menu – they hover state is that they jump up above where you’re clicking your mouse so the mouse click doesn’t do anything. How idiotic is that? Yes, support will tell you how to hack the css and fix it. But why aren’t THEY fixing this nonsense to begin with?

    I realize that the theme designs and these blog posts are two different things, done by different people, so I’m not joining the “stop bogging and make themes” chant – but it is a difficult decision. I’ll either go for the lifetime deal or just drop it altogether. Not sure which yet. But every time that dadgum “subscribe” banner pops up when I’m trying to read one of these blog posts on my smartphone (which is impossible to close) I’m a little closer to jumping ship. (I thought they fixed that a couple of weeks ago, but it is back with a vengeance. Hint… I ALREADY SUBSCRIBE!!!!!)

  7. I use the free Windows Live writer to post to my core sites from my PC. It gives better control over formatting then e mail.

  8. Easy way to post on WordPress blog on the go. Thank You for this Awesome guide.

  9. Is it possible to have an email post to display in a specific widget? Thanks.

  10. Nice specifications. I knew about the possibility, but never actually used it! (funny, he?)
    I’m working on a website for a restaurant, this will allow them to post their daily menu by e-mail everyday, instead of opening the CMS – they don’t know shit from Shinola about CMS, but they know how to send e-mail !

  11. Can you please write a tutorial in respect to creating and using Cron jobs, and make it suitable for beginners?

    Thanks! 🙂

  12. Alright, that’s it…

    This is getting out of hand Nick. At least give us an update on what’s going on with the products and services that we’re paying you for!

    I’m now considering cancelling my membership. I’ll still be able to read all the blog posts, I just wont have to pay for it, and It’s not like I’ll be missing out on any Themes, because you guys aren’t producing any.

    -Keith

    • I have to agree, this is really getting out of hand, We’ve had to purchase multiple magazine themes elsewhere due to Extra taking so long.

      • There should only be an update at least to know where Extra is. I sensed a total revamped in the plugin architecture of Extra which started from Divi – to switched to other themes without displaying her shortcodes. Guys, this is quite big like programing a spaceship! Whatever the pros and cons are, we deserved an update though….

        However, the support team had been wonderful to crack every psd layout our art director created for website by using Divi, in this I’m quite grateful to ET 🙂

        Cheers!

    • I have to agree with you and I absolutely love the customer support at Elegant Themes (best ever in my experience). One theme a year isn’t enough to keep me from renewing even though I love Divi. You’d think with only one theme a year being produced they would at least not charge members for the Monarch plugin.

  13. Can not thank you enough Brenda! Never I could imagine in my wildest dreams that I could email my content into my word-press website and it will be published! I am immediately going to try it out!

  14. I can see this feature being really useful for clients who prefer to write in email instead of WordPress. Thanks for sharing!

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Get Started With Divi