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 :)