I have used below code:
<?php
$file = fopen("contacts.csv","r");
while(! feof($file))
{
$age=fgetcsv($file);
foreach($age as $x_value)
{
$to = $x_value;
$subject = "HTML email";
$message = "<html><head><title>HTML email</title></head><body>here ismessage</body></html>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <abc@example.com>' . "\r\n";
mail($to,$subject,$message,$headers);
}
}
fclose($file);
?>
I tried this, but this will not work because this is not secure. So what method should I use?