links for 2009-01-29

January 29th, 2009. Published under Links. No Comments.

links for 2009-01-14

January 14th, 2009. Published under Links. No Comments.

links for 2009-01-05

January 5th, 2009. Published under Links. No Comments.

links for 2008-12-31

December 31st, 2008. Published under Links. No Comments.

Setting up wp-mail.php polling on OS X

December 9th, 2008. Published under WordPress. No Comments.

My friend Joakim had recently set up publishing via e-mail on his WordPress blog. But for some reason it simply did not work. He asked me to take a look and the first thing I noticed was that the POP3 username was wrong. After the fix, I expected things to start working, no such luck.

After a minute or so of googling I found this page. It stated that you need to call http://[yourblogdomain/wordpressinstalldir]/wp-mail.php to make WordPress fetch and publish the e-mails. The page also offered several methods to activate fetching, such as, an iframe, plugins, cron, procmail, etc.. Since I and Joakim run our sites on OS X machines, I decided it would be nice to have a proper launchd configuration that would call the URLs for me on a regular interval of 5 minutes. Here is what I came up with.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>KeepAlive</key>
        <false/>
        <key>Label</key>
        <string>wp-mail</string>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/bin/curl</string>
            <string>-f</string>
            <string>-s</string>
            <string>http://[yourblogdomain/wordpressinstalldir]/wp-mail.php</string>
        </array>
        <key>StartInterval</key>
        <integer>300</integer>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
        <key>StandardOutPath</key>
        <string>/dev/null</string>
    </dict>
</plist>

To get it up and running simply follow these steps…

  1. Create a file, named wp-mail.plist, containing the code above, inside /Library/LaunchDaemons on your OS X machine.
  2. Make sure you change [yourblogdomain/wordpressinstalldir] in the code to match your configuration.
  3. Run the following command as ROOT launchctl load /Library/LaunchDaemons/wp-mail.plist

Below is an excerpt from my terminal when I set up the polling.

[erik@server ~/]> cd /Library/LaunchDaemons [erik@server /Library/LaunchDaemons/]> sudo vi wp-mail.plist Password: ********* …Copied, pasted and modified code from above… [erik@server /Library/LaunchDaemons/]> sudo launchctl load wp-mail.plist [erik@server /Library/LaunchDaemons/]>