wordpress发邮件
If you run a multi-author blog, then notifying the authors when their blog post is published can help them promote the post and participate in the discussion. Recently, one of our readers asked if it was possible to email authors when their articles are published. In this article, we will show you how to email authors when their posts are published in WordPress.
如果您运行多作者博客,则在发布他们的博客帖子时通知作者可以帮助他们推广该帖子并参与讨论。 最近,一位读者问,发表文章时是否可以通过电子邮件发送给作者。 在本文中,我们将向您展示在WordPress中发布作者帖子时如何通过电子邮件发送给作者。
方法1:使用编辑流程将帖子通知发送给作者 (Method 1: Send Post Notifications to Authors using Edit Flow)
First thing you need to do is install and activate the Edit Flow plugin. For more details, see our step by step guide on how to install a WordPress plugin.
您需要做的第一件事是安装并激活Edit Flow插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。
Edit Flow works out of the box for email notifications. As soon as you activate the plugin, it will start sending email notifications to authors when their posts are published.
编辑流程开箱即用,可用于电子邮件通知。 激活插件后,发布者发布帖子后,它将开始向作者发送电子邮件通知。
However, it does not send those email notifications to site administrator. You can go to Edit Flow » Notifications page and select enable for ‘Always notify blog admin’ option.
但是,它不会将那些电子邮件通知发送给站点管理员。 您可以转到“ 编辑流»通知”页面,然后为“始终通知博客管理员”选项选择启用。
Edit Flow is a powerful plugin, and it can do a lot more than just sending email notifications. For a full overview of what you can do with it, see our guide on how to improve your editorial workflow in WordPress with Edit Flow.
Edit Flow是一个功能强大的插件,它不仅可以发送电子邮件通知,还可以做很多事情。 有关使用该功能的完整概述,请参阅我们的指南, 该指南介绍了如何使用Edit Flow改进WordPress中的编辑工作流程 。
方法2:使用更好的WordPress通知的电子邮件作者 (Method 2: Email Authors using Better Notifications for WordPress)
This method is for users who just want to send email notifications to authors without any other editorial features of Edit Flow.
此方法适用于只希望向作者发送电子邮件通知而没有“编辑流”的任何其他编辑功能的用户。
First thing you need to do is install and activate the Better Notifications for WordPress plugin.
您需要做的第一件事是安装并激活WordPress更好的通知插件。
Upon activation, you need to visit Notifcations » Add New page to create your author email notification.
激活后,您需要访问通知»添加新页面以创建您的作者电子邮件通知。
First you need to a enter a title for this notification, for e.g. ‘Post Published Notification for Authors’.
首先,您需要为此通知输入标题,例如“作者的发布后通知” 。
In the ‘Notification for’ field, you need to select ‘New post published’.
在“通知”字段中,您需要选择“发布新帖子” 。
Under Additional Email Fields option, check the box next to ‘Send this notification to the Author only’.
在“ 其他电子邮件字段”选项下,选中“ 仅将此通知发送给作者”旁边的框。
Now you need to write a subject line and email body. Better WordPress Notifications comes with a handful of shortcodes that you can use in your email subject and body.
现在,您需要编写主题行和电子邮件正文。 更好的WordPress通知附带了一些短代码,您可以在电子邮件主题和正文中使用它们。
In the email subject field you should enter:
在电子邮件主题字段中,您应该输入:
Post Published: [post_title]
Post Published: [post_title]
For message body, you can use this template:
对于邮件正文,可以使用以下模板:
Hello [user_nicename],
您好[user_nicename],
We just published your post “[post_title]”.
我们刚刚发布了您的帖子“ [post_title]”。
You can view it here: [permalink]
您可以在这里查看:[永久链接]
Thanks,
谢谢,
Finally, you need to click on the save button to store your new notification.
最后,您需要单击保存按钮来存储新通知。
The plugin will now send a notification email to authors when their posts are published in WordPress.
现在,当他们的帖子在WordPress中发布时,该插件将向作者发送通知电子邮件。
For more detailed instructions, see our guide on how to add better custom notifications in WordPress.
有关更多详细说明,请参见有关如何在WordPress中添加更好的自定义通知的指南。
方法3:在文章发表后手动向作者发送电子邮件 (Method 3: Manually Send Email to Authors When Their Articles are Published)
This method is for users who are comfortable adding code snippets in WordPress.
该方法适用于愿意在WordPress中添加代码段的用户。
You need to add this code to your theme’s functions.php file or a site-specific plugin.
您需要将此代码添加到主题的functions.php文件或特定于站点的插件中 。
function notifyauthor($post_id) {
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$subject = "Post Published: ".$post->post_title."";
$message = "
Hi ".$author->display_name.",
Your post, \"".$post->post_title."\" has just been published.
View post: ".get_permalink( $post_id )."
Thanks"
;
wp_mail($author->user_email, $subject, $message);
}
add_action('publish_post', 'notifyauthor');
This code runs when a new post is published in WordPress. It sends an email notification to the author using the subject and message defined in the code. Feel free to change the subject and message fields to meet your needs.
在WordPress中发布新帖子时,将运行此代码。 它使用代码中定义的主题和消息向作者发送电子邮件通知。 可以随意更改主题和消息字段,以满足您的需求。
Troubleshooting Tip:
故障排除提示:
If your authors complain about not receiving email notifications, then check out our guide on how to fix WordPress not sending email issue.
如果您的作者抱怨没有收到电子邮件通知,请查看有关如何修复WordPress不发送电子邮件问题的指南 。
We hope this article helped you email authors when their articles are published in WordPress. You may also want to see our expert pick of 21 plugins to efficiently manage WordPress multi-author blogs.
我们希望本文能帮助您在WordPress中发表文章时给作者发送电子邮件。 您可能还希望看到我们精选的21个插件来有效地管理WordPress多作者博客 。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。
wordpress发邮件