我想要一个可以发送批量电子邮件的PHP脚本 [英] i want a php script that can send bulk e-mails
本文介绍了我想要一个可以发送批量电子邮件的PHP脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在一天内发送批量电子邮件,所以我需要一个可以与SMTP邮件服务器连接的php脚本,每天最多可以发送100000封邮件。不应该放在垃圾邮件文件夹中。它应该放在目标邮箱地址的收件箱中。
这里是代码
i want to send bulk e mails in a day so i need a script in php that can connect with the SMTP mail server and can send up to 100000 mails in a day. that should not be putted in the spam folder. it should be placed in inbox of the destination mail address.
here is the code
<html>
<title>Email sender</title>
<style type="text/css">
body
{
background-color:black;
color:white;
}
#error
{
font-weight:bold;
color:red;
}
#success
{
font-weight:bold;
color:green;
}
a:link
{
text-decoration:none;
color:white;
}
a:visited
{
text-decoration:none;
color:white;
}
a:hover
{
text-decoration:none;
color:red;
}
</style>
<body>
<?php
$rand_alpha = array_merge(range('A', 'Z'), range('a', 'z'));
function checklink($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_NOBODY, true);
$result = curl_exec($curl);
$ret = false;
if ($result !== false)
{
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($statusCode == 200)
{
$ret = true;
}
}
curl_close($curl);
return $ret;
}
function getrand($arg1,$arg2="")
{
global $rand_alpha;
$str = "";
for($i=0;$i<$arg1;$i++)
{
$str.= $rand_alpha[array_rand($rand_alpha,1)];
}
if($arg2 != "")
{
$str2 = "";
$email_len = rand(3,12);
for($i=0;$i<$email_len;$i++)
{
$str2 .= $rand_alpha[array_rand($rand_alpha,1)];
}
$str .= '@'.$str2.'.com';
}
return $str;
}
?>
<center>
<h1>Advanced Email sender</h1>
<sub id="info">this is the mailing script</sub><br />
<?php
if (!function_exists( 'mail' ) )
{
$flag = 0;
$err[$init++] = 'mail() function is disbled on this server.';
}
if(isset($_GET['bomb']))
{
$flag = 0;
$email = $_GET['email'];
$file = $_GET['file'];
$no = (int)$_GET['no'];
$sub = $_GET['sub'];
$con = $_GET['content'];
$init = 0;
$point = 0;
if(isset($_GET['point']))
{
$point = $_GET['point'];
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$err[$init++] = 'Please enter a valid Email Address';
$flag = 1;
}
if(!is_int($no))
{
$err[$init++] = 'Number of emails to be sent should an integer';
$flag = 1;
}
else
{
if($no < 0)
{
$err[$init++] = 'Number of emails to be sent should be atleast 1';
$flag = 1;
}
if($no == 0)
{
$no = rand(0,20);
}
}
$err_count = count($err);
if($err_count > 0)
{
echo '<p id="error">';
for($shout=0;$shout<$err_count;$shout++)
{
echo $err[$shout].'<br />';
}
echo '</p>';
}
if($flag == 0)
{
echo '<p id="success">';
for($send=0;$send<$no;$send++)
{
$up = rand(5,15);
$down = rand(5,15);
$sender = 'From: '. getrand($up,$down);
if($sub == "" || $sub == NULL)
{
$rand = rand(5,30);
$sub = getrand($rand);
}
if($con == "" || $con == NULL)
{
$rand = rand(30,300);
$con = getrand($rand);
}
mail($email,$sub,$con,$sender);
}
echo 'Mail Sent '.$no.' times';
echo '</p>';
if($file != "")
{
if(file_exists($file))
{
$activate = 0;
$done = 0;
$fp = fopen($file,"r");
while (($line = fgets($fp, 4096)) !== false)
{
if(checklink($line))
{
if($point == $activate)
{
$goto = $line;
break;
}
else
{
$activate++;
}
}
}
$point++;
$goto .= '?email='.$email.'&file='.$file.'&no='.$no.'&sub='.$sub.'&content='.$con.'&bomb=BOMB&point='.$point;
echo ' <META HTTP-EQUIV="refresh" CONTENT="5;URL='.$goto.'">';
fclose($fp);
}
}
}
}
?>
<form method="get" action="">
<br /><table>
<tr><td>Email Address to Send:</td> <td><input type="text" name="email"></td></tr>
<tr><td>File Link for other servers:</td> <td><input type="text" name="file"></td></tr>
<tr><Td colspan=2><sub>If you leave min. no of emails to 0, random emails b/w 0-20 will be sent/server</sub></td></tr>
<tr><td>Number of emails per server</td><td><input type="text" name="no"></td></tr>
<tr><td colspan=2><sub>Message Subject and content.If you leave this empty, random content will be sent</sub></td></tr>
<tr><td>Message Subject:</td> <td><input type="text" name="sub"></td></tr>
<tr><td>Content:</td> <td><textarea name="content"></textarea></td></tr>
</table>
<input type="Submit" name="bomb" value="SEND">
</form>
</center>
</body>
</html>
但这不能正常工作
but this is not working properly
推荐答案
rand_alpha = array_merge(范围(' A' ,' Z'),range('' a',' z') );
function checklink(
rand_alpha = array_merge(range('A', 'Z'), range('a', 'z')); function checklink(
url)
{
url) {
curl = curl_init(
curl = curl_init(
这篇关于我想要一个可以发送批量电子邮件的PHP脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文