I have a website on the web, and I want to use CronJob, to send newsletters every Monday. Now, I'm using PHP to do this, and I'm stuck. I have a mail() function, that sends mail, to every address stated in a file.
Here is my CronJob file. I changed the date to everyday, just for debugging.
0 9 * * * php -f /home/a4770799/public_html/mail/newsletter.php
Here is my PHP file. This is the whole file.
<?php
$subject = "Weekly Newsletter";
$msg = "This is a weekly newsletter debugging test.";
$headers = "From: noreply@test.com" . "\r\n" .
"Reply-To: example@test.com" . "\r\n";
$linesofmail = file("mail_address_list.txt");
foreach ($linesofmail as $line_num => $line) {
mail ($line, $subject, $msg, $headers);
}
?>
What might be the problem here? I would love it, if someone would explain the problem to me, instead of just giving me a piece of code.