Home  >  Article  >  Backend Development  >  How to implement batch query of WordPress commenter’s email address with PHP, WordPress commenter_PHP tutorial

How to implement batch query of WordPress commenter’s email address with PHP, WordPress commenter_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:06:351303browse

How to implement batch query of WordPress commenter’s email address in PHP, WordPress commenter

Today I received a lot of New Year greeting messages via email from blogger friends. Hehe, it feels very fun, but how did they achieve this? It’s very simple, but it can be divided into two steps:

1) Get the email address through SQL query

2) Send mass emails through some method

For 1, a few lines of PHP code can solve:

Copy code The code is as follows:

xmlns="http://www.w3.org/1999/xhtml">


WordPress Bulk Email Tool Designed By Kaisir


//Database address to connect to
$db_server="localhost";
//Database username
$db_user_name="Change this to your database username";
//Database password
$db_user_password="Change here to your database password";
//Database name
$db_name="Change this to your database name";
//Please do not modify the following code
$sql="SELECT DISTINCT comment_author_email FROM `blog_comments` WHERE 1";
$conn=mysql_connect($db_server,$db_user_name,$db_user_password);
if(!$conn)
{
echo"

Database connection failed! Please check the username and password!

";
exit(0);
}
$flag=mysql_select_db($db_name,$conn);
if(!$flag)
{
echo"

The database connection is normal, but the specified database cannot be opened!

";
exit(0);
}
//Execute query
$result=mysql_query($sql,$conn);
while($row=mysql_fetch_array($result))
{
?>
,
}
mysql_close($conn);//Close the database connection
?>


For 2, this is more troublesome... Because any mail service provider will block you with such a large amount of data, so the best way is to build your own SMTP server, or use a mass sending tool, hehe, You can Google this yourself :)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/958720.htmlTechArticleHow to implement batch query of WordPress commenters’ E-mail addresses in PHP. WordPress commenters received many emails from blogger friends today. -Mail New Year greetings messages, hehe, it feels fun, but how do they...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn