Home  >  Article  >  Backend Development  >  How to implement batch query of WordPress commenter’s email address with PHP_PHP Tutorial

How to implement batch query of WordPress commenter’s email address with PHP_PHP Tutorial

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

How to implement batch query of WordPress commentator’s E-mail address with PHP

This article mainly introduces the implementation method of PHP batch query of WordPress commentator’s E-mail address. This article directly gives Implementation code, friends in need can refer to it

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:

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/958569.htmlTechArticleHow to implement batch query of WordPress commenters’ E-mail addresses with PHP. This article mainly introduces PHP batch query of WordPress commenters. E-mail address implementation method, this article directly gives the implementation code, what is needed...
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