-7

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Anand Parmar
  • 168
  • 3
  • 13
  • 4
    Sounds like you are asking to build a spam-distributor. Please elaborate the question by explaining *why* you want to send such a large number of e-mails and what you have already tried to do this. – Adriaan Sep 13 '15 at 10:26
  • 3
    Does this answer your question? [How to send 100,000 emails weekly?](https://stackoverflow.com/questions/3905734/how-to-send-100-000-emails-weekly) – shreyasm-dev Sep 03 '20 at 20:24

1 Answers1

0

You can use an Email Sending Service such as Amazon Simple Email Service. https://aws.amazon.com/ses/

They will charge you for the service, but the costs are very affordable: $0.1 per thousand emails

The integration with cakephp is pretty easy, but you will need to use the CakeEmail Library and use SMTP Transport.

http://book.cakephp.org/2.0/en/core-utility-libraries/email.html