8768 sujets

Développement web côté serveur, CMS

Bonjour,
j'utilise depuis ce matin PHPMailer pour envoyer les mails de newsletters de mon site web.
J'ai déclenché l'envoi manuel d'une newsletter de test tout à l'heure, mais les mails arrivent en double.
Que faire ?
Merci d'avance.
Bonjour,

Vérifiez l'intégration de votre code, il doit y avoir une commande redondante.

Et si vous le publiez qu'on puisse voir ce que ça donne ?
Bonjour,
voici mon code :
<?php
require($_SERVER['DOCUMENT_ROOT']."/mailer/PHPMailerAutoload.php");

$mailer=new PHPMailer();
$mailer->SetLanguage("fr",".");
/* Ce programme envoie automatiquement la newsletter et nettoye la table. */

include('dbconnect.php');

# Netoyage de la table
$req = $bdd->prepare('DELETE FROM newsletter_mails WHERE expire<?');
$req->execute(array(time()));

# Sélection des mails
$r = '(freq=1';
if(localtime()[3] == 1)# premier jour du mois
$r .= ' OR freq=5';
if(localtime()[6] == 1 and intval(date('W'))%2 == 0)# lundi et semaine paire
$r .= ' OR freq=4';
if(localtime()[6] == 1)# lundi
$r .= ' OR freq=3';
if(localtime()[7]%2 == 0)# jour pair sur l'année
$r .= ' OR freq=2';
$r .= ')';

# Lister les catégories
$cat = array();
$req = $bdd->query('SELECT * FROM softwares_categories');
while($data = $req->fetch()) {$cat[$data['id']] = $data['name'];}

# Prendre des infos à envoyer
$req = $bdd->prepare('SELECT * FROM softwares WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$sft = array();
while($data = $req->fetch()) {
$sft[] = $data;
}

$req = $bdd->prepare('SELECT * FROM softwares_files WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$files = array();
while($data = $req->fetch()) {
$files[] = $data;
}

$message1 = "<!DOCTYPE html>
<html>
<head>
<meta charset=\"utf-8\" />
<title>Newsletter ProgAccess33</title>
<style type=\"text/css\">
@font-face {font-family: Cantarell;src: url(https://progaccess33.net/css/Cantarell-Regular.otf);}
html, body {margin: 0;padding: 0;font-family: Cantarell;}
.software {border-left: 2px dashed black;padding-left: 10px;}
.software_title {margin-bottom: -8px;}
.software_date {color: #606060;margin-left: 15px;}
.software_hits, .software_category {color: #008000;}
</style>
</head>
<body>
<div id=\"header\">
<img id=\"logo\" alt=\"Logo\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAVi0lEQVR4nO1daVBUR9fumQEGRmE2BnBDwBiJn69GxQUZg4BljIkWxPUzlgoTTcWExS9YlWBckrjEJa+JSSzXuCQaTalEDZgYfEUrC1HcSESRWC5xoQYE3JIYhOf7gbedO32HubPq69yn6hTDmXu6z+1+bm+3+wyBBJ8GedgOSHi4kAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OPwKAHq6upQX18viZPy999/e7J6AHiYAGFhYSCESOKkrFu3zpPVA8DDBDAYDA+9EP+bZe3atZ6sHgASAR5pkVoAHxeJAD4uEgF8XCQC+LhIBPBxeewJcODAAdTU1HhFamtrsXr1amRmZiIzMxM3btzwWt5CcuPGDSQnJ/s2AY4fPw4AaGpq8rgAwMqVK2neNTU1bk3b0fsAgKFDh0oE8CZ+/fVXmvehQ4fclq41EcTCHgEe+4UgbxMAABQKBQghWLZsmVvTlQgggEeJADU1NaisrET79u1BCEG3bt2wceNGbN26FXv37kVpaSmqqqq85g8gEcCjBDCbzVi5ciUGDx6MkJAQ0SPvwMBA9O3bF3PnzsWJEyc85h8gEcAjBFizZg169+7ttqmYXq/H1KlTUVlZ6XZfpUGgmwjQ1NSEZcuWoXXr1jbzSkxMREFBAf744w/4+/uDEILc3FyUl5fju+++Q25uLsLDw1v0d9iwYfjtt9/c4jMgEcAtBNixY4dgE5+dnY2LFy9iyJAhIISgb9++1CY+Ph6EEPTs2ZNJb/78+bx0uEGjpYwfPx4NDQ0u+y4RwAUC3L59G0lJSbz0nnrqKSiVShBC8MknnwAANm/eTL8HgLKyMsTFxdH+/sMPP8QPP/z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content\">
<h2>Nouveaux logiciels et mises à jour</h2>";
$message2 = '<a id="link" href="https://progaccess33.net/nlmod.php?id=';
$message3 = '">Cliquez ici pour modifier les paramètres de votre abonnement ou vous désinscrire.</a>
<p>Ce mail a été envoyé automatiquement, merci de ne pas répondre.</p>
<p>Cordialement,<br />L\'équipe ProgAccess33</p>
</div>
</body>
</html>';

$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=UTF-8';
$headers[] = 'From: ProgAccess33 <noreply@progaccess33.net>';
$headers = implode("\r\n", $headers);
$subject = 'Newsletter ProgAccess33';

# Envoi des mails
$req = $bdd->prepare('SELECT * FROM newsletter_mails WHERE confirm=1 AND '.$r);
$req->execute();
while($data = $req->fetch()) {
$message = $message1;
foreach($sft as $software) {
if($software['date'] > $data['lastmail']) {
$message .= '<hr /><div class="software"><a href="article.php?id='.$software['id'].'"><h2 class="software_title">'.$software['name'].'</h2></a><p><span class="software_category">('.$cat[$software['category']].')</span> '.$software['description'].'<br /><span class="software_hits">'.$software['hits'].' visites</span><span class="software_date"> (mise à jour le '.date('d/m/Y à H:i:s', $software['date']).')</span></p><ul>';
foreach($files as $file) {
if($file['sw_id'] == $software['id'])
$message .= '<li>'.$file['title'].'</li>';
}
$message .= '</ul></div>';
}
}
if($message != $message1) {
$message .= $message2.$data['hash'].$message3;

$mailer->AddAddress($data['mail']);
$mailer->AddCustomHeader("x-IP: ".$_SERVER['REMOTE_ADDR']);
$mailer->AddReplyTo("noreply@progaccess33.net");
$mailer->IsSMTP();
$mailer->Host = "mail.gansta93.com";
$mailer->port = 587;
$mailer->SMTPAuth = true;
$mailer->Username = "noreply@progaccess33.net";
$mailer->Password = "Pddi3_98";
$mailer->IsHTML(TRUE);
$mailer->AltBody=($message);
$mailer->Body=($message);
$mailer->setFrom("noreply@progaccess33.net", "l'équipe ProgAccess33");
$mailer->HostName="progaccess33.net";
$mailer->Sender="noreply@progaccess33.net";
$mailer->Subject=($subject);
$mailer->CharSet = "UTF-8";
$mailer->Send();
if ($mailer->IsError())
{
echo $mailer->ErrorInfo;
exit();
}
}
else {}
/* mail($data['mail'], $subject, $message, $headers); */
$req2 = $bdd->prepare('UPDATE newsletter_mails SET lastmail=? WHERE id=?');
$req2->execute(array(time(), $data['id']));
}
$req->closeCursor();
?>
Cette condition n'ouvre pas d'accolade
if($file['sw_id'] == $software['id'])


En corrigeant l'accolade manquante, cela fonctionne-t-il mieux ?
Re,
nouveau code :

<?php
require($_SERVER['DOCUMENT_ROOT']."/mailer/PHPMailerAutoload.php");

$mailer=new PHPMailer();
$mailer->SetLanguage("fr",".");
/* Ce programme envoie automatiquement la newsletter et nettoye la table. */

include('dbconnect.php');

# Netoyage de la table
$req = $bdd->prepare('DELETE FROM newsletter_mails WHERE expire<?');
$req->execute(array(time()));

# Sélection des mails
$r = '(freq=1';
if(localtime()[3] == 1)# premier jour du mois
$r .= ' OR freq=5';
if(localtime()[6] == 1 and intval(date('W'))%2 == 0)# lundi et semaine paire
$r .= ' OR freq=4';
if(localtime()[6] == 1)# lundi
$r .= ' OR freq=3';
if(localtime()[7]%2 == 0)# jour pair sur l'année
$r .= ' OR freq=2';
$r .= ')';

# Lister les catégories
$cat = array();
$req = $bdd->query('SELECT * FROM softwares_categories');
while($data = $req->fetch()) {$cat[$data['id']] = $data['name'];}

# Prendre des infos à envoyer
$req = $bdd->prepare('SELECT * FROM softwares WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$sft = array();
while($data = $req->fetch()) {
$sft[] = $data;
}

$req = $bdd->prepare('SELECT * FROM softwares_files WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$files = array();
while($data = $req->fetch()) {
$files[] = $data;
}

$message1 = "<!DOCTYPE html>
<html>
<head>
<meta charset=\"utf-8\" />
<title>Newsletter ProgAccess33</title>
<style type=\"text/css\">
@font-face {font-family: Cantarell;src: url(https://progaccess33.net/css/Cantarell-Regular.otf);}
html, body {margin: 0;padding: 0;font-family: Cantarell;}
.software {border-left: 2px dashed black;padding-left: 10px;}
.software_title {margin-bottom: -8px;}
.software_date {color: #606060;margin-left: 15px;}
.software_hits, .software_category {color: #008000;}
</style>
</head>
<body>
<div id=\"header\">
<img id=\"logo\" alt=\"Logo\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAVi0lEQVR4nO1daVBUR9fumQEGRmE2BnBDwBiJn69GxQUZg4BljIkWxPUzlgoTTcWExS9YlWBckrjEJa+JSSzXuCQaTalEDZgYfEUrC1HcSESRWC5xoQYE3JIYhOf7gbedO32HubPq69yn6hTDmXu6z+1+bm+3+wyBBJ8GedgOSHi4kAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OPwKAHq6upQX18viZPy999/e7J6AHiYAGFhYSCESOKkrFu3zpPVA8DDBDAYDA+9EP+bZe3atZ6sHgASAR5pkVoAHxeJAD4uEgF8XCQC+LhIBPBxeewJcODAAdTU1HhFamtrsXr1amRmZiIzMxM3btzwWt5CcuPGDSQnJ/s2AY4fPw4AaGpq8rgAwMqVK2neNTU1bk3b0fsAgKFDh0oE8CZ+/fVXmvehQ4fclq41EcTCHgEe+4UgbxMAABQKBQghWLZsmVvTlQgggEeJADU1NaisrET79u1BCEG3bt2wceNGbN26FXv37kVpaSmqqqq85g8gEcCjBDCbzVi5ciUGDx6MkJAQ0SPvwMBA9O3bF3PnzsWJEyc85h8gEcAjBFizZg169+7ttqmYXq/H1KlTUVlZ6XZfpUGgmwjQ1NSEZcuWoXXr1jbzSkxMREFBAf744w/4+/uDEILc3FyUl5fju+++Q25uLsLDw1v0d9iwYfjtt9/c4jMgEcAtBNixY4dgE5+dnY2LFy9iyJAhIISgb9++1CY+Ph6EEPTs2ZNJb/78+bx0uEGjpYwfPx4NDQ0u+y4RwAUC3L59G0lJSbz0nnrqKSiVShBC8MknnwAANm/eTL8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letter ProgAccess33</h1>
</div>
<div id=\"content\">
<h2>Nouveaux logiciels et mises à jour</h2>";
$message2 = '<a id="link" href="https://progaccess33.net/nlmod.php?id=';
$message3 = '">Cliquez ici pour modifier les paramètres de votre abonnement ou vous désinscrire.</a>
<p>Ce mail a été envoyé automatiquement, merci de ne pas répondre.</p>
<p>Cordialement,<br />L\'équipe ProgAccess33</p>
</div>
</body>
</html>';

$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=UTF-8';
$headers[] = 'From: ProgAccess33 <noreply@progaccess33.net>';
$headers = implode("\r\n", $headers);
$subject = 'Newsletter ProgAccess33';

# Envoi des mails
$req = $bdd->prepare('SELECT * FROM newsletter_mails WHERE confirm=1 AND '.$r);
$req->execute();
while($data = $req->fetch()) {
$message = $message1;
foreach($sft as $software) {
if($software['date'] > $data['lastmail']) {
$message .= '<hr /><div class="software"><a href="article.php?id='.$software['id'].'"><h2 class="software_title">'.$software['name'].'</h2></a><p><span class="software_category">('.$cat[$software['category']].')</span> '.$software['description'].'<br /><span class="software_hits">'.$software['hits'].' visites</span><span class="software_date"> (mise à jour le '.date('d/m/Y à H:i:s', $software['date']).')</span></p><ul>';
foreach($files as $file) {
if($file['sw_id'] == $software['id']) {
$message .= '<li>'.$file['title'].'</li>'; }
}
$message .= '</ul></div>';
}
}
if($message != $message1) {
$message .= $message2.$data['hash'].$message3;

$mailer->AddAddress($data['mail']);
$mailer->AddCustomHeader("x-IP: ".$_SERVER['REMOTE_ADDR']);
$mailer->AddReplyTo("noreply@progaccess33.net");
$mailer->IsSMTP();
$mailer->Host = "mail.gansta93.com";
$mailer->port = 587;
$mailer->SMTPAuth = true;
$mailer->Username = "noreply@progaccess33.net";
$mailer->Password = "Pddi3_98";
$mailer->IsHTML(TRUE);
$mailer->AltBody=($message);
$mailer->Body=($message);
$mailer->setFrom("noreply@progaccess33.net", "l'équipe ProgAccess33");
$mailer->HostName="progaccess33.net";
$mailer->Sender="noreply@progaccess33.net";
$mailer->Subject=($subject);
$mailer->CharSet = "UTF-8";
$mailer->Send();
if ($mailer->IsError())
{
echo $mailer->ErrorInfo;
exit();
}
}
else {}
/* mail($data['mail'], $subject, $message, $headers); */
$req2 = $bdd->prepare('UPDATE newsletter_mails SET lastmail=? WHERE id=?');
$req2->execute(array(time(), $data['id']));
}
$req->closeCursor();
?>

je ne comprends pas ton dernier message.
pa33 a écrit :

je ne comprends pas ton dernier message.
Contrairement à la dernière version du code posté, ce que je voulais dire par là pour la précédente est que l'envoi de mail ($mailer->Send();) était inclus dans la boucle qui détermine $software. Donc si $sft contient 2 éléments, le mail est envoyé deux fois.
Et donc sur la version du code ce n'est pas le cas ?
pourtant ça ne fonctionne toujours pas Smiley decu
Malheureusement je ne dispose pas de Bdd configurée qui me me permettrait d'effectuer des essais et à première vue le code semble correcte.

Êtes-vous sûr que cette page n'est bien appelée qu'une seule fois ?
Bonjour,

j'ai refais le code en suivant les exemples de PHPMailer et en utilisant la dernière version de ce dernier,

le mail arrive bien une seule fois, mais il s'arrête après le titre indiquant :
nouveaux logiciels et mises à jour.
Sûrement un petit pb pas trop grave mais faut le trouver, voici le code :



<?php
require($_SERVER['DOCUMENT_ROOT']."/PHPMailer-master/PHPMailerAutoload.php");
/* Ce programme envoie automatiquement la newsletter et nettoye la table. */

include('dbconnect.php');

# Netoyage de la table
$req = $bdd->prepare('DELETE FROM newsletter_mails WHERE expire<?');
$req->execute(array(time()));

# Sélection des mails
$r = '(freq=1';
if(localtime()[3] == 1)# premier jour du mois
$r .= ' OR freq=5';
if(localtime()[6] == 1 and intval(date('W'))%2 == 0)# lundi et semaine paire
$r .= ' OR freq=4';
if(localtime()[6] == 1)# lundi
$r .= ' OR freq=3';
if(localtime()[7]%2 == 0)# jour pair sur l'année
$r .= ' OR freq=2';
$r .= ')';

# Lister les catégories
$cat = array();
$req = $bdd->query('SELECT * FROM softwares_categories');
while($data = $req->fetch()) {$cat[$data['id']] = $data['name'];}

# Prendre des infos à envoyer
$req = $bdd->prepare('SELECT * FROM softwares WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$sft = array();
while($data = $req->fetch()) {
$sft[] = $data;
}

$req = $bdd->prepare('SELECT * FROM softwares_files WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$files = array();
while($data = $req->fetch()) {
$files[] = $data;
}

$message1 = "<!DOCTYPE html>
<html>
<head>
<meta charset=\"utf-8\" />
<title>Newsletter ProgAccess33</title>
<style type=\"text/css\">
@font-face {font-family: Cantarell;src: url(https://progaccess33.net/css/Cantarell-Regular.otf);}
html, body {margin: 0;padding: 0;font-family: Cantarell;}
.software {border-left: 2px dashed black;padding-left: 10px;}
.software_title {margin-bottom: -8px;}
.software_date {color: #606060;margin-left: 15px;}
.software_hits, .software_category {color: #008000;}
</style>
</head>
<body>
<div id=\"header\">
<img id=\"logo\" alt=\"Logo\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAVi0lEQVR4nO1daVBUR9fumQEGRmE2BnBDwBiJn69GxQUZg4BljIkWxPUzlgoTTcWExS9YlWBckrjEJa+JSSzXuCQaTalEDZgYfEUrC1HcSESRWC5xoQYE3JIYhOf7gbedO32HubPq69yn6hTDmXu6z+1+bm+3+wyBBJ8GedgOSHi4kAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OPwKAHq6upQX18viZPy999/e7J6AHiYAGFhYSCESOKkrFu3zpPVA8DDBDAYDA+9EP+bZe3atZ6sHgASAR5pkVoAHxeJAD4uEgF8XCQC+LhIBPBxeewJcODAAdTU1HhFamtrsXr1amRmZiIzMxM3btzwWt5CcuPGDSQnJ/s2AY4fPw4AaGpq8rgAwMqVK2neNTU1bk3b0fsAgKFDh0oE8CZ+/fVXmvehQ4fclq41EcTCHgEe+4UgbxMAABQKBQghWLZsmVvTlQgggEeJADU1Na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FgouC3MOpyaELZt+4rfxxI/dIp5wmlf3E2AmKhOzAxg27Ztdu3Onz8vuB3MOjK5p+EVAjQ0NEDpH8g05fPnz7drW1FxVvCNmbOYOoVdCJrqwkKQ9bI2IQQVFfa3rM2fv4DpOpQBgWhoaHDaF2fgtZNBqalpzLq3Rq2FMeEZJAwYiIQBRiQMGAjjgIH3/2/W9Y3rxyyVyogcvXvFISHe+EC4NOj/Rqv/B8KYMBARYW3YpenwNkhIGPjARqT06hXH9OFyokDfuH4t+GGEMWEgNCFa/kkpokBa2khvVQfF/wNdhJyK9WTM+wAAAABJRU5ErkJggg==\" />
<h1>Newsletter ProgAccess33</h1>
</div>
<div id=\"content\">
<h2>Nouveaux logiciels et mises à jour</h2>";
$message2 = '<a id="link" href="https://progaccess33.net/nlmod.php?id=';
$message3 = '">Cliquez ici pour modifier les paramètres de votre abonnement ou vous désinscrire.</a>
<p>Ce mail a été envoyé automatiquement, merci de ne pas répondre.</p>
<p>Cordialement,<br />L\'équipe ProgAccess33</p>
</div>
</body>
</html>';

$subject = 'Newsletter ProgAccess33';

# Envoi des mails
$req = $bdd->prepare('SELECT * FROM newsletter_mails WHERE confirm=1 AND '.$r);
$req->execute();
while($data = $req->fetch()) {
$message = $message1;
foreach($sft as $software) {
if($software['date'] > $data['lastmail']) {
$message .= '<hr /><div class="software"><a href="article.php?id='.$software['id'].'"><h2 class="software_title">'.$software['name'].'</h2></a><p><span class="software_category">('.$cat[$software['category']].')</span> '.$software['description'].'<br /><span class="software_hits">'.$software['hits'].' visites</span><span class="software_date"> (mise à jour le '.date('d/m/Y à H:i:s', $software['date']).')</span></p><ul>';
foreach($files as $file) {
if($file['sw_id'] == $software['id'])
$message .= '<li>'.$file['title'].'</li>';
}
$message .= '</ul></div>';
}
}
if($message != $message1) {
$message .= $message2.$data['hash'].$message3; }
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = "mail.zajda.fr";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = "noreply@progaccess33.net";
$mail->Password = "Dz5i?3d5";
$mail->setFrom('noreply@progaccess33.net', 'l\'équipe ProgAccess33');
$mail->addReplyTo('miklhcos@progaccess33.net', 'Admin');
$mail->addAddress($data['mail']);
$mail->Subject = $subject;
$mail->CharSet = "UTF-8";
$mail->IsHTML(TRUE);
$mail->Body =($message);
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
$req2 = $bdd->prepare('UPDATE newsletter_mails SET lastmail=? WHERE id=?');
$req2->execute(array(time(), $data['id']));
}
$req->closeCursor();
?>



une idée ?
Bonjour,
le dernier pb était dû a un mauvais bidouillage de ma part, voici le code final :



<?php
require('/var/www/vhosot/accessibiliteprogrammes.fr/httpdocs/PHPMailer-master/PHPMailerAutoload.php');
/* Ce programme envoie automatiquement la newsletter et nettoye la table. */

include('dbconnect.php');

# Netoyage de la table
$req = $bdd->prepare('DELETE FROM newsletter_mails WHERE expire<?');
$req->execute(array(time()));

# Sélection des mails
$r = '(freq=1';
if(localtime()[3] == 1)# premier jour du mois
$r .= ' OR freq=5';
if(localtime()[6] == 1 and intval(date('W'))%2 == 0)# lundi et semaine paire
$r .= ' OR freq=4';
if(localtime()[6] == 1)# lundi
$r .= ' OR freq=3';
if(localtime()[7]%2 == 0)# jour pair sur l'année
$r .= ' OR freq=2';
$r .= ')';

# Lister les catégories
$cat = array();
$req = $bdd->query('SELECT * FROM softwares_categories');
while($data = $req->fetch()) {$cat[$data['id']] = $data['name'];}

# Prendre des infos à envoyer
$req = $bdd->prepare('SELECT * FROM softwares WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$sft = array();
while($data = $req->fetch()) {
$sft[] = $data;
}

$req = $bdd->prepare('SELECT * FROM softwares_files WHERE date>=? ORDER BY date DESC');
$req->execute(array(time()-2678400));# récents d'au plus un mois
$files = array();
while($data = $req->fetch()) {
$files[] = $data;
}

$message1 = "<!DOCTYPE html>
<html>
<head>
<meta charset=\"utf-8\" />
<title>Newsletter ProgAccess33</title>
<style type=\"text/css\">
@font-face {font-family: Cantarell;src: url(https://progaccess33.net/css/Cantarell-Regular.otf);}
html, body {margin: 0;padding: 0;font-family: Cantarell;}
.software {border-left: 2px dashed black;padding-left: 10px;}
.software_title {margin-bottom: -8px;}
.software_date {color: #606060;margin-left: 15px;}
.software_hits, .software_category {color: #008000;}
</style>
</head>
<body>
<div id=\"header\">
<img id=\"logo\" alt=\"Logo\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAVi0lEQVR4nO1daVBUR9fumQEGRmE2BnBDwBiJn69GxQUZg4BljIkWxPUzlgoTTcWExS9YlWBckrjEJa+JSSzXuCQaTalEDZgYfEUrC1HcSESRWC5xoQYE3JIYhOf7gbedO32HubPq69yn6hTDmXu6z+1+bm+3+wyBBJ8GedgOSHi4kAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OOQCODjkAjg45AI4OPwKAHq6upQX18viZPy999/e7J6AHiYAGFhYSCESOKkrFu3zpPVA8DDBDAYDA+9EP+bZe3atZ6sHgASAR5pkVoAHxeJAD4uEgF8XCQC+LhIBPBxeewJcODAAdTU1HhFamtrsXr1amRmZiIzMxM3btzwWt5CcuPGDSQnJ/s2AY4fPw4AaGpq8rgAwMqVK2neNTU1bk3b0fsAgKFDh0oE8CZ+/fVXmvehQ4fclq41EcTCHgEe+4UgbxMAABQKBQghWLZsmVvTlQgggEeJADU1NaisrET79u1BCEG3bt2wceNGbN26FXv37kVpaSmqqqq85g8gEcCjBDCbzVi5ciUGDx6MkJAQ0SPvwMBA9O3bF3PnzsWJEyc85h8gEcAjBFizZg169+7ttqmYXq/H1KlTUVlZ6XZfpUGgmwjQ1NSEZcuWoXXr1jbzSkxMREFBAf744w/4+/uDEILc3FyUl5fju+++Q25uLsLDw1v0d9iwYfjt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cvXvFISHe+EC4NOj/Rqv/B8KYMBARYW3YpenwNkhIGPjARqT06hXH9OFyokDfuH4t+GGEMWEgNCFa/kkpokBa2khvVQfF/wNdhJyK9WTM+wAAAABJRU5ErkJggg==\" />
<h1>Newsletter ProgAccess33</h1>
</div>
<div id=\"content\">
<h2>Nouveaux logiciels et mises à jour</h2>";
$message2 = '<a id="link" href="https://progaccess33.net/nlmod.php?id=';
$message3 = '">Cliquez ici pour modifier les paramètres de votre abonnement ou vous désinscrire.</a>
<p>Ce mail a été envoyé automatiquement, merci de ne pas répondre.</p>
<p>Cordialement,<br />L\'équipe ProgAccess33</p>
</div>
</body>
</html>';

$subject = 'Newsletter ProgAccess33';

# Envoi des mails
if(isset($_GET['debug'])) {
$req = $bdd->prepare('SELECT * FROM newsletter_mails WHERE confirm=1 AND mail=?');
$req->execute(array($_GET['debug']));
}
else
{
$req = $bdd->prepare('SELECT * FROM newsletter_mails WHERE confirm=1 AND '.$r);
$req->execute();
}
while($data = $req->fetch()) {
$message = $message1;
foreach($sft as $software) {
if($software['date'] > $data['lastmail']) {
$message .= '<hr /><div class="software"><a href="article.php?id='.$software['id'].'"><h2 class="software_title">'.$software['name'].'</h2></a><p><span class="software_category">('.$cat[$software['category']].')</span> '.$software['description'].'<br /><span class="software_hits">'.$software['hits'].' visites</span><span class="software_date"> (mise à jour le '.date('d/m/Y à H:i:s', $software['date']).')</span></p><ul>';
foreach($files as $file) {
if($file['sw_id'] == $software['id'])
$message .= '<li>'.$file['title'].'</li>';
}
$message .= '</ul></div>';
}
}
if($message != $message1) {
$message .= $message2.$data['hash'].$message3;
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = 'mail.zajda.fr';
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = 'noreply@progaccess33.net';
$mail->Password = 'Dz5i?3d5';
$mail->setFrom('noreply@progaccess33.net', 'l\'équipe ProgAccess33');
$mail->addReplyTo('miklhcos@progaccess33.net', 'Admin');
$mail->addAddress($data['mail']);
$mail->Subject = $subject;
$mail->CharSet = 'UTF-8';
$mail->IsHTML(TRUE);
$mail->Body = ($message);
$mail->send();
$req2 = $bdd->prepare('UPDATE newsletter_mails SET lastmail=? WHERE id=?');
$req2->execute(array(time(), $data['id']));
}
}
$req->closeCursor();
?>



en espérant que ça puisse en aider d'autres Smiley smile