i'm developing a small plugin which will send email to users when a new magazine is published.
i made a post type name "magazine" on the theme functions.php. and i wrote a plugin for email subscriptions.
code:
function newsletter_sendEmails($post_id)
{
$post = get_post($post_id);
if ($post->post_type == 'magazine')
{
mail( "[email protected]", "מגזין חדש", "התפרסם מגזין חדש!" );
}
}
add_action('publish_post', 'newsletter_sendEmails');
but from some reason i don't get the email when i publish a new magazine, why is that?
wp_mail()
as you should?