Short WP New Post Email Notification List

by Marty on June 25, 2010

Wordpress email

There are quite a few plugins that add mailing list functionality to your blog, meaning that users can subscribe to mailing lists, new posts or new comment notifications – and so on. A problem arose when I decided that I wanted to add a notification system to a new blog (having never used such a system before), but I wanted to integrate subscriptions via a third party email management application that I use for, well, at least a few hundred different lists. I didn’t want to have to have a new list integrated within WordPress.

Here’s a quick function that will notify a short list of people when you publish a post – good if you just want to email out a small group of authors. You can download the very lightweight code below and upload it to plugins directory (after editing required fields), then activate as per usual.





function email_list($post_ID)  {
   $friends = 'user1@domain.com, user2@domain.net, user3@domain.org';
   $headers = 'From: YourNameHere ' . "\r\n\\";
   mail($friends, "My Blog is Updated" , 'New post published on my blog: http://www.My-Domain-Name.com', $headers);
   return $post_ID;
}
add_action('publish_post', 'email_list');

I built upon this basic code and simply query a third party database, import the address and relevant data into an array, and then use a similar function as I have published above to send the mail (using the SMTP plugin WP SMTP Mail). By integrating, I can retain full functionality offered by my commericial mail software such as open rates, open times, bounce rates and so on – and I don’t have to manage fractionalised marketing data.

I’ll test it for a few weeks and – if all goes to plan – I will make the code available on this site as a downloadable plugin for use with a popular open source mail platform that many people use.

Download: Email Post Notification
email-list.zip
Version: 0.1

513.0 B
Details…

Share this page:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • FriendFeed
  • Identi.ca
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks

If you liked this article, you may also like:

  1. A problem with the PHP mail function… and alternatives
  2. Disabling and Deleting WordPress Post Revisions
  3. WordPress Post Missed Schedule
  4. Add WordPress tags within your post
  5. Adsense Code within Content

{ 1 comment… read it below or add one }

Neazy July 10, 2010 at 9:04 pm

I didn’t realise creating a WP plugin was so easy if I knew a little PHP. Back into the books.

ReplyReply

Reply

Leave a Comment

Previous post:

Next post:

Get Adobe Flash playerPlugin by wpburn.com wordpress themes