Hi All
I am working on a php based mail out script.
Im having all sorts of problems lol, and wondered if you guys could steer me on the right path
Here is the code
The first problem is that it seems to be sending each name in the database mutliple emails, it should only send the email to each person once.
Secondly, the mail headers are being included in the email when I send it to one of my test accounts.
Also, I need to be able to send the emails as html, how can I do that with this script
Thanks Guys
Aaron
I am working on a php based mail out script.
Im having all sorts of problems lol, and wondered if you guys could steer me on the right path
Here is the code
Code:
<?php require_once('../Connections/essential.php');
mysql_select_db($database_essential, $essential);
$eventsquery = "SELECT email FROM newsletter_users";
$result = mysql_query($eventsquery);
$num = mysql_num_rows($result);
for ($i = 0; $i < $num; $i++){
$arr[$i] = mysql_fetch_array($result);
@extract($_POST);
$subject = stripslashes($subject);
$fromemail = stripslashes($fromemail);
$content = ($content);
foreach ($arr[$i] as $email) {
$mailto = $email;
$mailsubject = 'Feedback from Essential Manchester.com';
$mailheaders .= "From: $name <$email>\r\n";
$mailheaders .= "Reply-To: $email\r\n";
$mailheaders .= "Return-Path: $email\n";
$message .= "
$content //n
//n
To unsubscribe from the Essential Newsletter please click
";
mail($mailto,$mailsubject,$message,$mailheaders);
}
} ?>
The first problem is that it seems to be sending each name in the database mutliple emails, it should only send the email to each person once.
Secondly, the mail headers are being included in the email when I send it to one of my test accounts.
Also, I need to be able to send the emails as html, how can I do that with this script
Thanks Guys
Aaron