Hi,
A friend asked me to do a newsletter script for him, because he doesn't know PHP. I did it, but there are still some little problems I would like to correct. First, the source-code of the mail writing page :
<?php
include('db.php');
$message = $_POST['message'];
$titre = $_POST['titre'];
$compteur = 1;
//adresses
$sql = mysql_query('SELECT mail FROM newsletter_etienne');
if($sql) {
while ($adresse = mysql_fetch_assoc($sql))
{
$mail = $adresse['mail'];
$expediteur = "From: Newsletter Théâtre Marston <newsletter@site.com>\nMime-Version: 1.0\nContent-Type: text/html; utf_8encode\n";
mail($mail, $titre, $message, $expediteur);
echo '#' . $compteur . ' - ' . $mail . ' : envoyé avec succès !<br />';
}
}else{
mysql_error();
exit();
}
if(mail == true) {
$compteur++;
echo 'Total #' . $compteur . ' - emails envoyés avec succès !';
}else{
echo 'Les emails n'ont pas pu être envoyés!!';
}
mysql_close();
?>
First problem : the emails are received long after I send them, from 20 minutes later to one day later.
Second : the emails are sent two times each ; the first one is the good, and the second is empty ...
Third : there is " \ " before each " ' ". I tried to but a stripslashes, but it changes nothing. And the special characters are not displayed as they should. For example : "ç è é à ù ë Ö Ü" ... And there is a "Spam Filtered (ID:1941611)" at the end of each message ...
There is a lot of problems, but I really don't know how to fix them ... Can you help me, please ?
Thanks,
Sam
PS : there is some French parts in the code, sorry, it's because I usually speak French and my friend too, that's why it's written if French !