我有一个excel,其中我有大量的电子邮件地址。以下脚本与我合作正常。但是,我将如何获得正确的电子邮件,他们将收到电子邮件。以下脚本仅验证域和域之前的格式化字符串。任何人都可以建议我。我为此搜索了很多,但没有找到任何东西。任何代码都会有所帮助。
<?php
error_reporting(~E_ALL);
include('db.php');
$tot = 0;
$handle = fopen($_FILES["contact_csv"]["tmp_name"], "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
for ($c=0; $c < 1; $c++) {
if($data[0] !='')
{
$description=$_REQUEST['description'];
//print $user_id;exit;
$sql=mysql_query("INSERT INTO contacts(
name,
email,
phone_no,
description
)VALUES(
'".mysql_real_escape_string($data[0])."',
'".mysql_real_escape_string($data[1])."',
'".mysql_real_escape_string($data[2])."',
'".$description."'
)")or die(mysql_error());
require_once("verify.php");
$verify = new EmailVerify();
$email=$data[1];
if($verify->verify_domain($email) && ($verify->verify_formatting($email)))
{
$verified[] = $email;
$email_from = 'myemail@gmail.com';//<== update the email address
$email_subject = "Excel Upload";
$headers = "From: $email_from \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr><td><strong>Message:</strong> </td><td>" . htmlentities($description) . "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";
$to = $data[1];//<== update the email address
//Send the email!
mail($to,$email_subject,$message,$headers);
}
else
{
$notverified[]=$email;
}
}
$tot++;}
}
fclose($handle);
?>