Category: How To

Postie & GoDaddy

Postie works well with GoDaddy hosting, but you are required to use GoDaddy mail servers (rather than something like Gmail).

Create a new email address through the Cpanel functions in GoDaddy. After the email is created go to the Configure button that showed multiple ways to auto configure the email for many other hosts. At the bottom of the page it shows Manual Setup. This is for Postie.

When you enter the MailServer in Postie be sure to use the full server name: a2plcpnlxxxx.prod.iad2.secureserver.net (The xxxx will vary depending on your account)

Mail Server Settings

  • Protocol: POP3
  • Use Transport Layer Security: No
  • Server: a2plcpnlxxxx.prod.iad2.secureserver.net
  • Port: 110
  • Userid: your full email address
  • Password: your password

 

Postie & Gmail

Postie works well with Gmail (and Google apps for business), however, there are a few things that can get in the way.

First make sure your hosting company allows access to external mail servers. GoDaddy notably does not allow this. If you are hosting with GoDaddy there is no way to use Gmail, you must use the GoDaddy email server.

gmail_pop3

Second make sure you have enabled POP3 (or IMAP) access to your Gmail account. Go to the Forwarding and POP/IMAP tab in your Gmail settings and click the Enable POP for all mail radio button. See also the Gmail help page.

Finally set you settings to:

  • Connection: Sockets
  • Mail Protocol: POP3-SSL or IMAP-SSL
  • Port: 995 or 993
  • Mail Server: pop.gmail.com or imap.gmail.com
  • Userid: your full email address
  • Password: your password

Gmail will not work with POP3.

 

Occasionally Gmail will stop working and you can see a Postie error message that says something like “[ALERT] Please log in via your web browser”. This means you must log into the account Postie is trying to access via https://gmail.com where you will be asked to confirm a login from whereever your server is located.

If this doesn’t work try http://www.google.com/accounts/DisplayUnlockCaptcha

Turn off 2-Step Verification https://support.google.com/accounts/answer/1064203?hl=en

If you are still having difficulty you may need to change the Google “Less secure apps” setting. Be sure you are only signed into the gmail account that postie will use then go to https://www.google.com/settings/security/lesssecureapps and make sure it is set to “Turn off”

While the wording on this page makes it sound dangerous what it really means is “allow traditional authentication” which uses very high levels of encryption.

Finally check these pages for other options:

Supporting WebP

WebP is a new image format being promoted by Google.

By default WordPress (and therefor Postie) doesn’t support WebP images attached to emails. However, it is quite easy to add support.

First add WebP support to WordPress by installing the wp-webp plugin.

The second step is to ensure your web server is sending the correct MIME type for *.webp images (image/webp). A little Googling will explain how to check/add MIME types for your server. If you are using shared hosting contact your hoster to see if it is set up correctly.

Filter: postie_post_before

This filter is called just before Postie saves the post.

At the point the filter is called a placeholder post has been created, but it doesn’t have any content. All the attachments have been uploaded and associated with this post.

Parameters:

  • $post
  • $headers (available starting at version 1.7.28)

The $post parameter is an array describing the post extracted from the email.

Essentially any field described here can show up.

You may modify any of the array elements.

The $headers parameter is an array of email headers. Note that this will vary depending on where the email came from.

You must return the $post array from your function. You may return null to prevent the post from being saved.

Example without headers

add_filter('postie_post_before', 'my_postie_post_before');

function my_postie_post_before($post) {
    //Do something
    return $post;
}

Example with headers

add_filter('postie_post_before', 'my_postie_post_before', 10, 2);

function my_postie_post_before($post, $headers) {
    //Do something
    return $post;
}

Post array

Array index Notes
post_author the WordPress user that is the author of the post.
post_date the localized date of the post.
post_date_gmt the GMT/UMT date of the post.
post_content the actual content of the post.
post_title the post title (email subject line).
post_name the sanitized post title.
post_excerpt the post excerpt.
ID the post id.
post_status the post status.
post_category an array of category IDs
ping_status
comment_status
post_type

Note that if Postie detects a email reply it will add a comment to the original post and the data in the array will be as follows:

comment_author
comment_post_ID
comment_author_email
comment_date
comment_date_gmt
comment_content
comment_author_url
comment_author_IP
comment_approved
comment_agent
comment_type
comment_parent
user_id

See this for more details.

Header array

The header variable is an associative array of mail headers, the keys being the lowercase header names. By default the values are a string, but the following headers are further parsed:

  • received: An array of the Recieved headers
  • to: An array of parsed addressees, each being an associative array in the format:
    • mailbox: The part before the @
    • host: The part after the @
    • personal: The addressee’s name optional
  • cc: An array of parsed addressees, in the same format as to
  • from: An associative array of the from address, in the same format as to
  • sender: An associative array of the sender address, in the same format as to
  • reply-to: An associative array of the address to reply to, in the same format as to
  • content-type: An associative array in the format:
    • value: The main header value
    • fields: An associative array of the ; separated key=value pairs after the main value
  • content-disposition: An associative array in the same format as content-type

Postie & WP Super Cache

Some users have reported that Postie stops checking mail when WP Super Cache is installed.

You can fix this by adding “wp-content/plugins/postie/get_mail.php” to W3TC “Never cache the following pages” on the “Page Cache Settings tab”

Forcing an Email Check

Postie relies on the built-in WordPress Cron process to fetch emails and turn them into posts. However, WordPress requires that there be traffic to your site in order to run the Cron process.

The first check you must do to be sure the WordPress Cron is enabled. Clicking Test Config on the Postie settings page will tell you if Cron is disabled. Look for

Cron: On

If you see Cron: off open your wp-config.php file and find a line like

define('DISABLE_WP_CRON', true);

if present, remove it. WordPress Cron should now work.

External Cron

If you would prefer to have more fine-grained control of how Postie checks for mail or you can’t get the WordPress Cron to work, you can setup a cron job.

From Wikipedia

The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration—though its general-purpose nature makes it useful for things like connecting to the Internet and downloading email at regular intervals. The name cron comes from the Greek word for time, χρόνος chronos.

 

The Easy Way

If you are using a hosting company that doesn’t allow you access to cron or you don’t want to mess with it you can use a service like SetCronJob to access http://<mysite>/wp-cron.php

If your hosting company uses cPanel for managing your domain you can add a cron job through the cPanel interface. See the cron job docs then choose one of the commands listed below.

The Techie Way

Setup a cronjob to access http://<mysite>/wp-cron.php Note that every time you access this page Postie will run – it is like clicking Run Postie on the Admin screen.

Note that before Postie 1.6 the URL was: http://<mysite>/wp-content/plugins/postie/get_mail.php This URL is no longer supported.

Linux

If your site runs on a UNIX/linux server, and you have shell access, you can enable mail checking using cron.

Examples:
This fetches the mail every five minutes with lynx

*/5 * * * * /usr/bin/lynx --source http://<mysite>/wp-cron.php >/dev/null 2>&1

This fetches the mail every ten minutes with wget

*/10 * * * * /usr/bin/wget -O /dev/null http://<mysite>/wp-cron.php >/dev/null 2>&1

Windows

You will need to install wget or curl.
Then use the Task Scheduler control panel to call wget or curl.
Examples:
wget example

wget http://<mysite>/wp-cron.php

curl example

curl http://<mysite>/wp-cron.php

Enabling Debug Output

As of version 1.5.5 you can click the “Run Postie (Debug)” button to have Postie check for emails and report debugging information to the screen.

Postie Options

To always log debug info to a log file you can still do the following:

In your wp-config.php file look for the following:

define(‘WP_DEBUG’, false);

Replace it with:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('POSTIE_DEBUG', true);

Various errors, warning and informational will be written to the wp-content\debug.log file. There may also be all sorts of warnings and messages in your site as well depending on how well behaved your other plugins and themes are, so you will not want to leave these settings set to true all the time.

If the debug.log file doesn’t show up then create a file debug.log in the wp-content directory and then “chmod 666 debug.log” or use cpanel to do the same thing.

It is possible that the error log is in a different location. Running Postie or Test Config will tell you where it is located (as of 1.4.26).