• Hello all!

    I’ve been trying to find an answer to this for awhile but I have yet to figure it out.

    We are using wordpress as an notification system for our organization and it’s been working great so far. The only thing we are trying to figure out is how to get wordpress to also send an email to a pre-determined email address with either the entire body of the post or a snippet of it.

    I’m wondering if anyone out there might know of a module or hack in order to do this. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try using Feedburner for your RSS feed so that people can subscribe to your feed by email.

    Thread Starter ko_chin

    (@ko_chin)

    Sorry, I got side-tracked here by another project.

    I’ve considered the RSS approach except that these are notifications that we want to push to the entire community rather than relying on people to sign-up for a feed. Some of these notifications are policy changes, etc… and require us to push out via email.

    Any thoughts on that?

    Thread Starter ko_chin

    (@ko_chin)

    I’ve found some sample code that looks like it would do what I want but I’m not very clear being a beginner in WP how to proceed. This is what I found:

    function email_friends($post_ID)  {
       $friends = '[email protected], [email protected]';
       mail($friends, "sally's blog updated" , 'I just put something on my blog: https://blog.example.com');
       return $post_ID;
    }
    
    add_action('publish_post', 'email_friends');

    I found this while looking around here: https://codex.www.ads-software.com/Function_Reference/add_action

    I just need to figure out how I can make this work for a custom-post-type vs. a regular post. And i’m also a bit stuck as to where to place this function… can I put it in my themes function.php file or where would be more appropriate?

    Please help!

    Thread Starter ko_chin

    (@ko_chin)

    Nevermind.. I found a solution using Subscribe2 and making some edits in the code to accept my custom post types.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to send an email upon publishing a post’ is closed to new replies.