Jetpack Modules: Post by Email
Post by Email is a way of publishing posts on your blog using your email.
Post via email feature in Dashboard > Settings > Writing is been deprecated for some time and in future WordPress versions it will be removed from that interface.
But thanks to Jetpack, the idea is not buried and the Post by Email module adds many new comfortable features which we are going to show you in this article.
First let's activate Post by email module:
- Go to Jetpack > Settings > Writing
- Scroll down to Post by email block
- Switch on the radio button in front of text Publish posts by sending an email
- Create email address and copy it in a file
Any email client can be used to send the email, allowing you to publish quickly and easily from devices such as cell phones.
Note: The post by email feature is only available for email clients. If you try to post from PHP scripts like PHPMailer, Jetpack anti-spam filters will block your post.
Open your mail client (we will use Roundcube webmail client from cPanel) and type in the
To: field the email address that is configured by the Post by email module.
If you have not copied the email, return to Jetpack > Settings > Writing to do so. At any time, you can regenerate a new email address and start using it right away. Add some content in the message text field and send the email.
Now check your WordPress blog - the post is already there:
The email subject is used as your post's title. The body is the post's contents.
You can only post to one recipient at a time meaning if you have several WordPress sites and they all have Post by Email activated, you cannot publish this particular post in all sites by adding other email addresses in the
Your email can be plain text or HTML formatted. Post by Email system will strip unnecessary HTML tags so that your email is displayed correctly. In particular, italic, bold, blockquote, links and image (attachments) tags work as you see in the example.
Note that you will need to use an email client that supports rich text or HTML formatting in order to make use of this feature. Most website based clients (Hotmail, Gmail) do support this, as do most desktop clients (Thunderbird, Outlook, Mail). You may need to switch your client into rich text or formatted mode.
Image attachments will be included in your published post as follows:
- Single images will be displayed inline (a single image is defined as an image without an image immediately following it).
- Multiple images will be displayed as a gallery.
- Multiple galleries and single images are allowed in the same post. Note that using the [nogallery] shortcode will disable all galleries.
Post by email will automatically remove any email signatures that match the standard signature block pattern:
(two dashes followed by space).
It will also remove anything after a
<hr/> HTML tag and attempts to clean up cellphone network signatures.
If your email system attaches a signature that does not match any of these patterns then you can manually tell Post by Email to stop including text by adding the special
[end] shortcode on its own line with a blank line above it.
Special shortcodes can be embedded in your email to configure various aspects of the published post:
- [category x,y,z]
- [excerpt]some excerpt[/excerpt]
- [tags x,y,z]
- [delay +1 hour]
- [comments on | off]
- [status publish | pending | draft | private]
- [slug some-url-name]
- [title Your post title]
- [end] – everything after this shortcode is ignored (i.e. signatures). Make sure it's on its own line with a blank line above it.
- [slideshow] – replaces the auto-gallery with a slideshow
- [nogallery] – disables the auto-gallery and displays all images inline
- [more] – more tag
- [nextpage] – pagination
- [publicize off|yahoo|twitter|facebook] – change Publicize options.
Shortcodes can be included anywhere in the body of your email and must be in lowercase. There should be no spaces between the left square braket and the shortcode content.
Specifying the Category
The category shortcode will match the category-slug specified. For example: [category blog, email] will match the categories Blog (slug='blog') and Email (slug='email').
Note that categories must already exist on your blog for you to use the slug.
If you want to add a new category, just type the new category name in the shortcode along with any other category-slugs. Spaces between the commas are not important:
[category Tennis, email]
Any number of tags can be added to your post, each separated by a comma:
[tags Federer, Nadal]
This will add two new tags: Federer, Nadal. Note that your tags do not need to exist elsewhere in your blog and new tags will be created automatically.
The new category Tenis and two new tags Federer and Nadal were successfuly created by using shortcodes.
Changing your Publicize settings
Jetpack's Publicize lets you notify other web services about your posts. With the
[publicize] shortcode you can control this from emails. Note that your Publicize settings must have been previously configured for these shortcodes to work.
Also, if you have already configured Publicize and don't include these shortcodes in your post, it will be publicized to all of your connected Publicize networks.
- [publicize off] – disable all Publicize notifications
- [publicize twitter] – only send a notification to Twitter
- [publicize twitter]new post[/publicize] – only send a notification to Twitter and set the Twitter status to new post
- [publicize twitter facebook] – Sends a notification specifically to both Facebook and Twitter only.
Note that if you use more than one
[publicize] shortcode in your post (for example, both
[publicize twitter] and
[publicize facebook]), only the second shortcode will be used (in this case,
If you want to Publicize to only those two services such as in this example, you need to use a combined shortcode, like
[publicize twitter facebook].
Delaying Your Post
The delay shortcode will accept any time allowed by PHP's strtotime. For example, you can:
[delay +1 hour]
[delay +2 days]
The title of the published post is usually extracted from the subject of your email.
If for some reason you do not have an subject field in the mobile phone interface, you can still assign a title in the email message itself by using the
[title Post Title]
If you supply both - a subject line title and a shortcode title only the shortcode title will be included in the post:
Changing your post status
Sometimes you may want your post to be private, or to be reviewed by yourself or someone else at a later date before being published. To do this, you can use the [status] shortcode to set the post status.
Email with Shortcodes
The following email will be published in two days' time to the Tennis category, with tags tournaments and Grand Slam:
The first Grand Slam tennis tournament for the year is the Australian Open. [tags tournaments, Grand Slam] [category tennis] [delay +2 day]
Post by Email is a very handy feature with lots of options and we recommend you to test the ones you are going to use before you start posting on your website.