How to Automatically notify users/registered members on new post

By October 5, 2017 WordPress No Comments
How to Send Email to All Registered Users in WordPress

How to Send Email to All Registered Users in WordPress without using plugin?

Getting audience as much as possible is the primary goal of any website owner or any blogger. For this email marketing is also a good option. if you want to increase customer engagement on your website blog post, you can use this technique. you can auto mail all the registered user when any new article or post created on your site. It is beneficial for both user can find their relative post directly on mail and website can get more user.  Well this is basically very useful if you have a big list of user registered on your WordPress blog.

As i always told, do things without using plugin as much possible. You don’t need to install any heavy plugin for small task. you can do many thing by adding some extra hook and code snippets in your website theme function.php file.+

Solution 1: Send mail without HTML Tags –

This below code snippets only allow simple string message. you can’t pass any HTML tag it to message body. if you want to send HTML Template in mail please user second solution listed below.

So now lets implement this hook in functions.php

Here $wpdb->wp_users  is my table name in database, so is you are using any prefix for table name or your table name is different than change it accordingly to your database table name, otherwise it will give error message.

Solution 2: Send mail with HTML Tags –

If you want to send a complete HTML template in to mail you can use below code snippets.

This Second email solution is more beneficial, you can modify the HTML section according to your need and can make a nice email template.


[paypal-donation]

About Vijay Dhanvai

A passionate blogger by heart and mind, I have been working in this field for 10 years now. A WordPress Professional, web developer and designer who intends to guide his readers about Web Design, WordPress, Blogging, Web Development, and more.

Leave a Reply