1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
|
<?php
$xml_modulo = new html_template();
$xml_modulo->dir = '_forms';
$xml_modulo->path = 'newsletter.tpl';
if(isset($_GET['sent']) AND $_GET['sent'] == 'true'){
$INF = 'Newsletter wurde erfolgreich versendet!';
$xml_modulo = $INF;
}elseif(isset($_POST['nlCont'])){
//send newsletter!
if(empty($_POST['cc'])){
$cc = 'der-Newsletter';
}else{
$cc = htmlspecialchars($_POST['cc']);
}
$getVALIDusers = new getmysql();
$getVALIDusers->sql = "SELECT email, prename, lastname, phone, handy, street, housenum, plz, location, country FROM teilnehmer WHERE optin='1'";
$getVALIDusers->only_ressrc = true;
$getVALIDusers = $getVALIDusers->sendrequest();
if(empty($getVALIDusers)){
$xml_modulo = '<strong>Keine validen User gefunden</strong>';
}else{
$mail_header = 'Content-Type: text/html'."\r\n".'From: domain.de <newsletter@domain.de>';
$mail_betreff = $cc;
$mail_content = $_POST['nlCont'];
while($sendNL = mysql_fetch_object($getVALIDusers)){
$LEGEND = array(
'{[DB:vorname]}'=>htmlspecialchars(mysql_unescape_string($sendNL->prename)),
'{[DB:nachname]}'=>htmlspecialchars(mysql_unescape_string($sendNL->lastname)),
'{[DB:telefonnummer]}'=>htmlspecialchars(mysql_unescape_string($sendNL->phone)),
'{[DB:handynummer]}'=>htmlspecialchars(mysql_unescape_string($sendNL->handy)),
'{[DB:strasse]}'=>htmlspecialchars(mysql_unescape_string($sendNL->street)),
'{[DB:hausnummer]}'=>htmlspecialchars(mysql_unescape_string($sendNL->housenum)),
'{[DB:postleitzahl]}'=>htmlspecialchars(mysql_unescape_string($sendNL->plz)),
'{[DB:ort]}'=>htmlspecialchars(mysql_unescape_string($sendNL->location)),
'{[DB:land]}'=>htmlspecialchars(mysql_unescape_string($sendNL->country))
);
$AC_MAIL_CONTENT = $mail_content;
foreach($LEGEND AS $legendkey=>$legendcont){
$AC_MAIL_CONTENT = str_replace($legendkey,$legendcont,$AC_MAIL_CONTENT);
}
if(!@mail($sendNL->email,$mail_betreff,$AC_MAIL_CONTENT,$mail_header)){
$errorOnNl = true;
}
}
if($errorOnNl === true){
$xml_modulo = 'Es sind Fehler beim Versenden aufgetreten.';
}else{
header('Location: index.php?action=lplg&plugin=22&sent=true');
}
}
}else{
//show form
$xml_modulo = $xml_modulo->create();
}
$content = $xml_modulo;
?> |