简体   繁体   English

如何在WordPress中将新帖子通知电子邮件订阅者?

[英]How to notify email subscribers on new posts in WordPress?

How to notify email subscribers on new posts thru PHP? 如何通过PHP通知电子邮件订阅者有关新帖子的信息? The subscribers' email is stored outside Wordpress, let say it's stored on another server. 订户的电子邮件存储在Wordpress外部,可以说存储在另一台服务器上。

I found several articles, like this.. Article 1 我找到了几篇类似的文章。 第1条

but it only send an email to all registered users in Wordpress. 但只会将电子邮件发送给所有在Wordpress中注册的用户。

I think, in this case, you may need to use the Wordpress save_post hook which is fired after a post has been saved. 我认为,在这种情况下,您可能需要使用保存帖子后触发的Wordpress save_post挂钩。 You can read more here: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post 您可以在此处阅读更多信息: https : //codex.wordpress.org/Plugin_API/Action_Reference/save_post

So, what you could do is something like this in your functions.php file 因此,您可以在functions.php文件中执行以下操作

function on_create_send_email( $post_id ) {

    // If this is just a revision, don't send the email.
    if ( wp_is_post_revision( $post_id ) )
        return;

    //Handle your users and send the emails
}
add_action( 'save_post', 'on_create_send_email' );

How you choose to handle the mass email would be a matter of personal preference. 您如何选择处理大量电子邮件将是个人喜好问题。 There are plugins that will help out or you could integrate this with something like Mailchimp. 有一些插件可以为您提供帮助,或者您可以将其与Mailchimp等集成。

If sending a daily update works for your situation, my suggestion would be to use MailChimp's RSS-to-Email feature . 如果根据您的情况发送每日更新,我的建议是使用MailChimp的RSS-to-Email功能 It will only fire (at the same time every day) if there are new posts, and it won't ever include posts that have already been included in a previous email. 仅当有新帖子时才会(每天在同一时间)触发,并且永远不会包含上一封电子邮件中已经包含的帖子。

The one thing this feature doesn't do, is send immediate updates. 此功能不做的一件事就是发送即时更新。 In other words: if you want an email to be sent out the second a post is published, you'll need a plugin like this one (a little outdated). 换句话说:如果你想要一个电子邮件被发送出去的第二帖子发布后,你需要像一个插件这样一个 (有点过时)。 Or this one . 还是这个 That is, if you're OK using MailChimp for sending out your emails (highly recommened though). 也就是说,如果您可以使用MailChimp发送电子邮件(虽然非常推荐),则可以。 I haven't used any of these plugins myself, so I won't be able to comment on their quality / ease of use - but I hope this helps you find your solution. 我自己没有使用过这些插件中的任何一个,因此我将无法评论它们的质量/易用性-但我希望这可以帮助您找到解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM