Exemplo n.º 1
0
 function executeAction()
 {
     $mail_from = $this->getElement(2);
     $mail_to = $this->getElement(3);
     $mail_subject = $this->getElement(4);
     $mail_body = $this->getElement(5);
     foreach ($this->params['value_pool']['email'] as $search => $replace) {
         $mail_body = str_replace('###' . $search . '###', $replace, $mail_body);
         $mail_body = str_replace('+++' . $search . '+++', urlencode($replace), $mail_body);
         $mail_subject = str_replace('###' . $search . '###', $replace, $mail_subject);
         $mail_subject = str_replace('+++' . $search . '+++', urlencode($replace), $mail_subject);
         $mail_to = str_replace('###' . $search . '###', $replace, $mail_to);
         $mail_from = str_replace('###' . $search . '###', $replace, $mail_from);
     }
     $mail = new rex_mailer();
     $mail->AddAddress($mail_to, $mail_to);
     $mail->WordWrap = 80;
     $mail->FromName = $mail_from;
     $mail->From = $mail_from;
     $mail->Sender = $mail_from;
     $mail->Subject = $mail_subject;
     $mail->Body = nl2br($mail_body);
     $mail->AltBody = strip_tags($mail_body);
     // $mail->IsHTML(true);
     $mail->Send();
 }
Exemplo n.º 2
0
function rex_newsletter_sendmail($userinfo, $aid, $mail_reply, $mail_subject)
{
    global $REX;
    $tmp_redaxo = $REX['REDAXO'];
    $REX['REDAXO'] = true;
    // ***** HTML VERSION KOMPLETT
    $REX_ARTICLE = new rex_article();
    $REX_ARTICLE->setCLang(0);
    $REX_ARTICLE->setArticleId($aid);
    $REX_ARTICLE->getContentAsQuery(TRUE);
    // $REX_ARTICLE->setTemplateId(xx);
    $REX['ADDON']['NEWSLETTER_TEXT'] = FALSE;
    $html_body = $REX_ARTICLE->getArticleTemplate();
    // ***** TEXT VERSION
    $REX_ARTICLE = new rex_article();
    $REX_ARTICLE->setCLang(0);
    $REX_ARTICLE->setArticleId($aid);
    $REX_ARTICLE->getContentAsQuery(TRUE);
    // $REX_ARTICLE->setTemplateId(xx);
    $REX['ADDON']['NEWSLETTER_TEXT'] = TRUE;
    // FILTERN VERSION KOMPLETT
    $text_body = $REX_ARTICLE->getArticle();
    $text_body = str_replace("<br />", "<br />", $text_body);
    $text_body = str_replace("<p>", "\n\n</p>", $text_body);
    $text_body = str_replace("<ul>", "\n\n</ul>", $text_body);
    $text_body = preg_replace("#(\\<)(.*)(\\>)#imsU", "", $text_body);
    $text_body = html_entity_decode($text_body);
    $REX['REDAXO'] = true;
    // ***** MAIL VERSAND
    // Allgemeine Initialisierung
    // $mail = new PHPMailer();
    $mail = new rex_mailer();
    $mail->AddAddress($userinfo["email"]);
    $mail->From = $mail_reply;
    $mail->FromName = $mail_reply;
    $subject = $mail_subject;
    // Subject
    // Bodies
    // html
    foreach ($userinfo as $k => $v) {
        $subject = str_replace("###" . $k . "###", $v, $subject);
        $html_body = str_replace("###" . $k . "###", $v, $html_body);
        $text_body = str_replace("###" . $k . "###", $v, $text_body);
        $subject = str_replace("###" . strtoupper($k) . "###", $v, $subject);
        $html_body = str_replace("###" . strtoupper($k) . "###", $v, $html_body);
        $text_body = str_replace("###" . strtoupper($k) . "###", $v, $text_body);
    }
    // text
    // echo "<pre>$text_body</pre>";
    $mail->Subject = $subject;
    $mail->AltBody = $text_body;
    $mail->Body = $html_body;
    $mail->Send();
    $REX['REDAXO'] = $tmp_redaxo;
}
 function execute()
 {
     global $REX;
     $gt = new rex_sql();
     if ($this->params["debug"]) {
         $gt->debugsql = true;
     }
     $gt->setQuery('select * from rex_xform_email_template where name="' . $this->action["elements"][2] . '"');
     if ($gt->getRows() == 1) {
         $mail_to = $REX['ERROR_EMAIL'];
         if (isset($this->action["elements"][3]) && $this->action["elements"][3] != "") {
             foreach ($this->elements_email as $key => $value) {
                 if ($this->action["elements"][3] == $key) {
                     $mail_to = $value;
                 }
             }
         }
         if (isset($this->action["elements"][4]) && $this->action["elements"][4] != "") {
             $mail_to = $this->action["elements"][4];
         }
         $mail_from = $gt->getValue("mail_from");
         $mail_subject = $gt->getValue("subject");
         $mail_body = $gt->getValue("body");
         foreach ($this->elements_email as $search => $replace) {
             $mail_from = str_replace('###' . $search . '###', $replace, $mail_from);
             $mail_subject = str_replace('###' . $search . '###', $replace, $mail_subject);
             $mail_body = str_replace('###' . $search . '###', $replace, $mail_body);
             $mail_from = str_replace('***' . $search . '***', urlencode($replace), $mail_from);
             $mail_subject = str_replace('***' . $search . '***', urlencode($replace), $mail_subject);
             $mail_body = str_replace('***' . $search . '***', urlencode($replace), $mail_body);
         }
         $mail = new rex_mailer();
         $mail->AddAddress($mail_to, $mail_to);
         $mail->WordWrap = 80;
         $mail->FromName = $mail_from;
         $mail->From = $mail_from;
         $mail->Subject = $mail_subject;
         $mail->Body = nl2br($mail_body);
         $mail->AltBody = strip_tags($mail_body);
         // $mail->IsHTML(true);
         if (!$mail->Send()) {
             echo "FAILED";
         }
     }
 }
Exemplo n.º 4
0
 public function execute()
 {
     include_once rex_path::addon('import_export', 'functions/function_import_export.php');
     include_once rex_path::addon('import_export', 'functions/function_import_folder.php');
     $filename = $this->getParam('filename', self::DEFAULT_FILENAME);
     $filename = str_replace('%REX_SERVER', parse_url(rex::getServer(), PHP_URL_HOST), $filename);
     $filename = str_replace('%REX_VERSION', rex::getVersion(), $filename);
     $filename = strftime($filename);
     $file = $filename;
     $dir = getImportDir() . '/';
     $ext = '.sql';
     if (file_exists($dir . $file . $ext)) {
         $i = 1;
         while (file_exists($dir . $file . '_' . $i . $ext)) {
             ++$i;
         }
         $file = $file . '_' . $i;
     }
     if (rex_a1_export_db($dir . $file . $ext)) {
         $message = $file . $ext . ' created';
         if ($this->sendmail) {
             if (!rex_addon::get('phpmailer')->isAvailable()) {
                 $this->setMessage($message . ', mail not sent (addon "phpmailer" isn\'t activated)');
                 return false;
             }
             $mail = new rex_mailer();
             $mail->AddAddress($this->mailaddress);
             $mail->Subject = rex_i18n::msg('im_export_mail_subject');
             $mail->Body = rex_i18n::msg('im_export_mail_body', rex::getServerName());
             $mail->AddAttachment($dir . $file . $ext, $filename . $ext);
             if ($mail->Send()) {
                 $this->setMessage($message . ', mail sent');
                 return true;
             }
             $this->setMessage($message . ', mail not sent');
             return false;
         }
         $this->setMessage($message);
         return true;
     }
     $this->setMessage($file . $ext . ' not created');
     return false;
 }
Exemplo n.º 5
0
function rex_newsletter_sendmail($userinfo, $mail_from_email, $mail_from_name, $mail_subject, $mail_body_text, $mail_body_html)
{
    global $REX;
    if (trim($userinfo["email"]) == "") {
        return FALSE;
    }
    $mail = new rex_mailer();
    $mail->AddAddress($userinfo["email"]);
    $mail->From = $mail_from_email;
    $mail->FromName = $mail_from_name;
    $mail->Subject = $mail_subject;
    if (trim($mail_body_html) != "") {
        $mail->Body = $mail_body_html;
        $mail->AltBody = $mail_body_text;
        foreach ($userinfo as $k => $v) {
            $mail->Body = str_replace("###" . $k . "###", $v, $mail->Body);
            $mail->Body = str_replace("###" . strtoupper($k) . "###", $v, $mail->Body);
            $mail->Body = str_replace("***" . $k . "***", urlencode($v), $mail->Body);
            $mail->Body = str_replace("***" . strtoupper($k) . "***", urlencode($v), $mail->Body);
            $mail->Subject = str_replace("###" . $k . "###", $v, $mail->Subject);
            $mail->Subject = str_replace("###" . strtoupper($k) . "###", $v, $mail->Subject);
            $mail->Subject = str_replace("***" . $k . "***", urlencode($v), $mail->Subject);
            $mail->Subject = str_replace("***" . strtoupper($k) . "***", urlencode($v), $mail->Subject);
            $mail->AltBody = str_replace("###" . $k . "###", $v, $mail->AltBody);
            $mail->AltBody = str_replace("###" . strtoupper($k) . "###", $v, $mail->AltBody);
            $mail->AltBody = str_replace("***" . $k . "***", urlencode($v), $mail->AltBody);
            $mail->AltBody = str_replace("***" . strtoupper($k) . "***", urlencode($v), $mail->AltBody);
        }
    } else {
        $mail->Body = $mail_body_text;
        foreach ($userinfo as $k => $v) {
            $mail->Body = str_replace("###" . $k . "###", $v, $mail->Body);
            $mail->Body = str_replace("###" . strtoupper($k) . "###", $v, $mail->Body);
            $mail->Body = str_replace("***" . $k . "***", urlencode($v), $mail->Body);
            $mail->Body = str_replace("***" . strtoupper($k) . "***", urlencode($v), $mail->Body);
            $mail->Subject = str_replace("###" . $k . "###", $v, $mail->Subject);
            $mail->Subject = str_replace("###" . strtoupper($k) . "###", $v, $mail->Subject);
            $mail->Subject = str_replace("***" . $k . "***", urlencode($v), $mail->Subject);
            $mail->Subject = str_replace("***" . strtoupper($k) . "***", urlencode($v), $mail->Subject);
        }
    }
    return $mail->Send();
}
 function execute()
 {
     $mail_from = $this->action["elements"][2];
     $mail_to = $this->action["elements"][3];
     $mail_subject = $this->action["elements"][4];
     $mail_body = $this->action["elements"][5];
     foreach ($this->elements_email as $search => $replace) {
         $mail_body = str_replace('###' . $search . '###', $replace, $mail_body);
     }
     $mail = new rex_mailer();
     $mail->AddAddress($mail_to, $mail_to);
     $mail->WordWrap = 80;
     $mail->FromName = $mail_from;
     $mail->From = $mail_from;
     $mail->Subject = $mail_subject;
     $mail->Body = nl2br($mail_body);
     $mail->AltBody = strip_tags($mail_body);
     // $mail->IsHTML(true);
     $mail->Send();
 }
 function sendMail($template)
 {
     $mail = new rex_mailer();
     $mail->AddAddress($template["mail_to"], $template["mail_to_name"]);
     $mail->SetFrom($template["mail_from"], $template["mail_from_name"]);
     $mail->Subject = $template["subject"];
     $mail->Body = $template["body"];
     if ($template["body_html"] != "") {
         $mail->AltBody = $template["body"];
         $mail->MsgHTML($template["body_html"]);
     } else {
         $mail->Body = strip_tags($template["body"]);
     }
     if (is_array($template["attachments"])) {
         foreach ($template["attachments"] as $f) {
             $mail->AddAttachment($f["path"], $f["name"]);
         }
     }
     return $mail->Send();
 }
 static function sendMail($template, $template_name = '')
 {
     $r = rex_register_extension_point('XFORM_EMAIL_BEFORE_SEND', array('template' => $template, 'template_name' => $template_name, 'status' => false));
     $template = $r['template'];
     $template_name = $r['template_name'];
     $status = $r['status'];
     if ($status) {
         return true;
     }
     $mail = new rex_mailer();
     $mail->AddAddress($template['mail_to'], $template['mail_to_name']);
     $mail->SetFrom($template['mail_from'], $template['mail_from_name']);
     $mail->Subject = $template['subject'];
     $mail->Body = $template['body'];
     if ($template['body_html'] != '') {
         $mail->AltBody = $template['body'];
         $mail->MsgHTML($template['body_html']);
     } else {
         $mail->Body = strip_tags($template['body']);
     }
     if (is_array($template['attachments'])) {
         foreach ($template['attachments'] as $f) {
             $mail->AddAttachment($f['path'], $f['name']);
         }
     }
     if ($mail->Send()) {
         $template['email_subject'] = $template['subject'];
         rex_register_extension_point('XFORM_EMAIL_SENT', $template_name, $template, true);
         // read only
         return true;
     } else {
         $template['email_subject'] = $template['subject'];
         rex_register_extension_point('XFORM_EMAIL_SENT_FAILED', $template_name, $template, true);
         // read only
         return false;
     }
 }
Exemplo n.º 9
0
 function a401_perform_ajax($_rex_ajax, $rxa, $REX)
 {
     $rxa['ajaxdir'] .= $REX['REDAXO'] ? 'backend/' : 'frontend/';
     if (!$REX['REDAXO'] and !$rxa['settings']['frontend_active']) {
         return;
     }
     if ($REX['REDAXO'] and !$rxa['settings']['backend_active']) {
         return;
     }
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $rxa['ajaxdir'] = str_replace("/", "\\", $rxa['ajaxdir']);
     }
     // Code ausführen falls die Datei vorhanden ist
     if (file_exists($rxa['ajaxdir'] . $_rex_ajax . '.inc.php')) {
         @ob_end_clean();
         @ob_end_clean();
         // Fix für REDAXO < 4.2.x
         if (isset($REX_ARTICLE)) {
             $REX['ARTICLE'] = $REX_ARTICLE;
         }
         // Include der Datei
         include_once $rxa['ajaxdir'] . $_rex_ajax . '.inc.php';
         exit;
     } else {
         if (trim($REX["ADDON"][$rxa['name']]["settings"]["errormail"]) != '') {
             $_subject = 'REX_Ajax Error ' . $REX['SERVER'] . ' ' . $REX['SERVERNAME'];
             $_mailtext = $_subject . "\n\n" . date('d.m.Y h:i:s') . "\n\n";
             ob_start();
             var_dump($_REQUEST);
             $_mailtext .= "_REQUEST\n";
             $_mailtext .= ob_get_contents();
             ob_end_clean();
             ob_start();
             var_dump($_SESSION);
             $_mailtext .= "\n_SESSION\n";
             $_mailtext .= ob_get_contents();
             ob_end_clean();
             ob_start();
             var_dump($_SERVER);
             $_mailtext .= "\n_SERVER\n";
             $_mailtext .= ob_get_contents();
             ob_end_clean();
             $_to = $REX["ADDON"][$rxa['name']]["settings"]["errormail"];
             $_header = 'From: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'Reply-To: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
             if (OOAddon::isAvailable('phpmailer')) {
                 if (!isset($I18N)) {
                     $I18N = rex_create_lang($REX['LANG']);
                 }
                 include $REX['INCLUDE_PATH'] . '/addons/phpmailer/config.inc.php';
                 $mail = new rex_mailer();
                 $mail->From = $REX['ERROR_EMAIL'];
                 $mail->Subject = $_subject;
                 $mail->Body = $_mailtext;
                 $mail->AddAddress($_to, '');
                 $mail->Send();
             } else {
                 @mail($_to, $_subject, $_mailtext, $_header);
             }
         }
     }
 }
Exemplo n.º 10
0
 /**
  * Errechnet aus dem Datum im Format TT.MM.JJJJ das Alter
  * @global type $REX
  * @param mixed[] $warenkorb Format:
  * Array(
  *		$kurs_id] => Array (
  *			[0] => Array(
  *				[vorname] =>
  *				[nachname] =>
  *				[geburtstag] =>
  *				[geschlecht] =>
  *			)
  *		)
  *	)
  * @param mixed $warenkorb
  * @param String $rechnungsadresse
  * @return boolean TRUE wenn Mail gesendet wurde
  */
 function sendAnmeldungen($warenkorb, $rechnungsadresse)
 {
     global $REX;
     $mail_has_content = false;
     $mail = new rex_mailer();
     $mail->IsHTML(true);
     $mail->CharSet = "utf-8";
     $mail->From = $rechnungsadresse['e-mail'];
     $mail->FromName = $rechnungsadresse['vorname'] . " " . $rechnungsadresse['nachname'];
     $mail->Sender = $rechnungsadresse['e-mail'];
     $mail->AddAddress($REX['ADDON']['d2u_kurse']['settings']['anmeldung_mail_empfaenger']);
     $mail->Subject = "Webanmeldung zu Kurs";
     $body = "<b>Rechnungsadresse:</b><br>";
     $body .= $rechnungsadresse['vorname'] . " " . $rechnungsadresse['nachname'] . "<br>";
     $body .= $rechnungsadresse['anschrift'] . "<br>";
     $body .= str_pad($rechnungsadresse['plz'], 5, 0, STR_PAD_LEFT) . ' ' . $rechnungsadresse['ort'] . "<br>";
     $body .= $rechnungsadresse['telefon'] . "<br>";
     $body .= '<a href="' . $rechnungsadresse['e-mail'] . '">' . $rechnungsadresse['e-mail'] . "</a><br>";
     $body .= "Geburtsdatum: " . formatDate($rechnungsadresse['geburtstag']) . "<br>";
     $body .= "Geschlecht: " . $rechnungsadresse['geschlecht'] . "<br>";
     $body .= "Gewünscht Zahlungsart: ";
     if ($rechnungsadresse['zahlungsart'] == "F") {
         $body .= "Lastschrift";
     } else {
         $body .= "Überweisung";
     }
     $body .= "<br>";
     $body .= "Name der Bank: " . $rechnungsadresse['bank'] . "<br>";
     $body .= "Kontoinhaber: " . $rechnungsadresse['kontoinhaber'] . "<br>";
     $body .= "BIC: " . $rechnungsadresse['bic'] . "<br>";
     $body .= "IBAN: " . $rechnungsadresse['iban'] . "<br>";
     $body .= "<br>";
     foreach ($warenkorb as $kurs_id => $teilnehmer) {
         $kurs = new Kurs($kurs_id, $REX['TABLE_PREFIX']);
         if ($kurs->titel != "") {
             $mail_has_content = true;
         } else {
             continue;
         }
         $body .= '<b>Anmeldung zu Kurs "' . $kurs->titel . '"';
         if ($kurs->kursnummer != "" && $kurs->titel != "") {
             $body .= " (" . $kurs->kursnummer . ")";
         }
         $body .= "</b><br>";
         foreach ($teilnehmer as $id => $personendaten) {
             $body .= "Vorname: " . $personendaten['vorname'] . "<br>";
             $body .= "Nachname: " . $personendaten['nachname'] . "<br>";
             $body .= "Geburtsdatum: " . formatDate($personendaten['geburtstag']) . "<br>";
             $body .= "Geschlecht: " . $personendaten['geschlecht'] . "<br>";
         }
     }
     $mail->Body = $body;
     if ($mail_has_content) {
         return $mail->Send();
     } else {
         return $mail_has_content;
     }
 }
/**
 * gbook_form_output
 *
 * @param Admin-EMail
 * @param Danke-Text
 * @param DebugLevel  Verschiedene Stufen zur Debugausgabe (vorerst nur per EMail)
 *
 */
function gbook_form_output($notificationEmail, $danke_text, $debuglevel, $formular_an_aus)
{
    global $REX;
    // vordefinieren einiger Variablen
    $error = '';
    $name = '';
    $email = '';
    $url = 'http://';
    $city = '';
    $text = '';
    if (!isset($danke_text)) {
        $danke_text = '';
    }
    /**
     * Um Spameinträge zu erschweren wurden die Feldnamen 'email' und 'url'
     * im Formular untereinander getauscht. Diese müssen nun zurückgetauscht werden.
     * Der normale Benutzer sollte davon nichts bemerken.
     */
    if (isset($_POST['email']) and $_POST['email'] != '') {
        $url_temp = $_POST['email'];
    } else {
        $url_temp = '';
    }
    if (isset($_POST['url']) and $_POST['url'] != '') {
        $email_temp = $_POST['url'];
    } else {
        $email_temp = '';
    }
    // gib den POST-Variablen die richtigen Werte
    $_POST['url'] = $url_temp;
    $_POST['email'] = $email_temp;
    // Wird true, wenn eine Eintrag erfolgreich geschrieben wurde
    $Eintrag_geschrieben = false;
    if (!isset($_POST['name'])) {
        $_POST['name'] = '';
    }
    if (!isset($_POST['text'])) {
        $_POST['text'] = '';
    }
    if (!isset($_POST['url'])) {
        $_POST['url'] = '';
    }
    if (!isset($_POST['email'])) {
        $_POST['email'] = '';
    }
    if (!isset($_POST['city'])) {
        $_POST['city'] = '';
    }
    // gbook_formularPostCheck($postvars, $domainname = false)
    if (($errorfields = validFields()) === true and gbook_formularPostCheck(array($_POST['name'], $_POST['text'], $_POST['url'], $_POST['email'], $_POST['city']))) {
        $author_value = checkPostVarForMySQL($_POST['name']);
        $message_value = checkPostVarForMySQL($_POST['text']);
        // wurde keine URL angegeben, entferne die "HTTP://"-Vorgabe
        if ($_POST['url'] == 'http://') {
            $_POST['url'] = '';
        }
        $url_value = checkPostVarForMySQL($_POST['url'], 'NULL');
        $email_value = checkPostVarForMySQL($_POST['email'], 'NULL');
        $city_value = checkPostVarForMySQL($_POST['city'], 'NULL');
        // Thema Sicherheit:
        // $status ist endweder 1, 0 oder false
        // die Funktion gbook_readStatusFromFile() läßt keine andere Rückgabe zu
        $status = gbook_readStatusFromFile();
        if ($status === false) {
            echo 'Fehler bei Statusermittlung des Eintrages aufgetreten. Setze Defaultwert 0. ';
            $status_db = 'status = "0",';
        } else {
            $status_db = 'status = "' . $status . '",';
        }
        //$qry = 'INSERT INTO '.TBL_GBOOK.' SET  author = "'.$author.'", message = "'.$message.'", url ="'.$url.'", email="'.$email.'", city="'.$city.'", created = UNIX_TIMESTAMP()';
        $qry = 'INSERT INTO ' . TBL_GBOOK . ' SET ' . $status_db . ' author = ' . $author_value . ', message = ' . $message_value . ',
            url = ' . $url_value . ', email = ' . $email_value . ', city = ' . $city_value . ',
            created = UNIX_TIMESTAMP()';
        $sql = new rex_sql();
        //$sql->debugsql = true;
        $sql->setQuery($qry);
        $Eintrag_geschrieben = true;
        // EMail an Admin
        if ($notificationEmail != '') {
            // DEBUG-Informationen zusammenstellen
            $debug_inhalt = '';
            if ($debuglevel == 1) {
                $debug_inhalt = "\r\n\r\n ==== DEBUG-INFORMATIONEN ==== \r\n";
                if (isset($_POST) and count($_POST) != 0) {
                    $debug_inhalt .= "\n === POST ===\n";
                    foreach ($_POST as $key => $wert) {
                        $debug_inhalt .= $key . ': ' . $wert . "\n";
                    }
                }
                if (isset($_GET) and count($_GET) != 0) {
                    $debug_inhalt .= "\n === GET ===\n";
                    foreach ($_GET as $key => $wert) {
                        $debug_inhalt .= $key . ': ' . $wert . "\n";
                    }
                }
                if (isset($_SERVER) and count($_SERVER) != 0) {
                    $debug_inhalt .= "\n === SERVER ===\n";
                    foreach ($_SERVER as $key => $wert) {
                        $debug_inhalt .= $key . ': ' . $wert . "\n";
                    }
                }
            }
            // if ($debuglevel == 1)
            $mail_host = !strstr($REX['SERVER'], 'http://') && !strstr($REX['SERVER'], 'https://') ? 'http://' . $REX['SERVER'] : $REX['SERVER'];
            if ($mail_host[strlen($mail_host) - 1] != '/') {
                $mail_host .= '/';
            }
            $mail_server = $mail_host . '/redaxo';
            /*      $mail_author = htmlspecialchars(rex_post('name', 'string'));
                  $mail_message = htmlspecialchars(rex_post('text', 'string'));
                  $mail_url = htmlspecialchars(rex_post('url', 'string'));
                  $mail_email = htmlspecialchars(rex_post('email', 'string'));
                  $mail_city = htmlspecialchars(rex_post('city', 'string'));
            */
            $mail_author = strip_tags(rex_post('name', 'string'));
            $mail_message = strip_tags(rex_post('text', 'string'));
            $mail_url = strip_tags(rex_post('url', 'string'));
            $mail_email = strip_tags(rex_post('email', 'string'));
            $mail_city = strip_tags(rex_post('city', 'string'));
            $mail_betreff = 'Neuer Gästebucheintrag für ' . $mail_host;
            $mail_nachricht = 'Im Gästebuch für die Webseite "' . $mail_host . '" wurde ein neuer Eintrag erstellt.' . "\r\n\r\n";
            $mail_nachricht .= 'Name: ' . $mail_author . "\r\n";
            $mail_nachricht .= 'Homepage: ' . $mail_url . "\r\n";
            $mail_nachricht .= 'eMail: ' . $mail_email . "\r\n";
            $mail_nachricht .= 'Wohnort: ' . $mail_city . "\r\n\r\n";
            $mail_nachricht .= 'Nachricht: ' . $mail_message . "\r\n\r\n\r\n";
            //$nachricht .= 'Hinweis: Dieser Eintrag wurde bei der Einstellung "Ver�ffentlichung nach Freigabe" deaktiviert gespeichert und erscheint erst dann in Ihren G�stebuch, wenn Sie den Eintrag aktiviert haben. Zum Log-In Bereich geht es unter '.$server."\r\n";
            // DebugInfo anhängen, falls gewünscht
            $mail_nachricht .= $debug_inhalt;
            $header = 'MIME-Version: 1.0' . "\r\n";
            //$header .= 'Content-type: text/plain; charset=iso-8859-1'."\r\n";
            $header .= 'Content-type: text/plain; charset=utf-8' . "\r\n";
            $header .= 'Content-Transfer-Encoding: 8bit' . "\r\n";
            $header .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
            $header .= 'From: ' . $notificationEmail . "\r\n";
            //      $header .= 'Bcc: foo@david.koala'."\r\n";
            if (class_exists('rex_mailer')) {
                $mail = new rex_mailer();
                $mail->AddAddress($notificationEmail);
                $mail->Sender = $notificationEmail;
                $mail->From = $notificationEmail;
                //$mail->FromName = "REX_VALUE[8] |".$REX['SERVERNAME'];
                $mail->Subject = $mail_betreff;
                $mail->Body = $mail_nachricht;
                $mail->Send();
                // Versenden
            } else {
                // Fallback
                mail($notificationEmail, $mail_betreff, $mail_nachricht, $header);
            }
        }
    } else {
        // if (($errorfields = validFields()) === true)
        // der Danke-Text erscheint nur nach dem erfolgreichen absenden des Formulares
        $danke_text = '';
        // Wurde eine falsche Eingabe festgestellt, fülle die Eingabefelder wieder
        // mit den ursprünglichen Werten und gibt eine Fehlernachricht aus.
        if (!empty($_POST['gbook_save'])) {
            // var_dump($_POST);
            // Felder mit Werten füllen
            $name = $_POST['name'];
            $email = $_POST['email'];
            $url = $_POST['url'];
            $city = $_POST['city'];
            $text = $_POST['text'];
            $error = '<ul class="error">';
            foreach ($errorfields as $fieldname) {
                $error .= '<li>Pflichtfeld "' . ucwords($fieldname) . '" bitte korrekt ausf&uuml;llen!</li>';
            }
            $error .= '</ul>';
        }
        // if (!empty ($_POST['gbook_save']))
    }
    // else { // if (($errorfields = validFields()) === true)
    // AUSGABE der Seite
    // wenn Template-Klasse noch nicht eingebunden, dann hole sie jetzt rein
    if (!class_exists('Template')) {
        include_once $REX['INCLUDE_PATH'] . '/addons/guestbook/classes/template.inc.php';
    }
    //$_ROOT['template'] = $REX['INCLUDE_PATH'].'/addons/guestbook/templates/';
    /* create Template instance called $t */
    $t = new Template(GBOOK_TEMPLATEPATH, "remove");
    //$t->debug = 7;
    $danketext_templ = 'gb_frontend_danketext.html';
    $formular_templ = 'gb_frontend_form.html';
    $frontend_templ = 'gb_frontend.html';
    /* lese Template-Datei */
    $t->set_file(array('danketext' => $danketext_templ, 'formular' => $formular_templ, 'start' => $frontend_templ));
    // Danketext
    $t->set_var(array("DANKE_TEXT_VALUE" => $danke_text));
    // Formular
    //$adresse = rex_geturl($GLOBALS['article_id']);
    $adresse = rex_geturl(&$REX['ARTICLE_ID']);
    $t->set_var(array("FEHLERMELDUNG_VALUE" => $error, "ADRESSE_VALUE" => $adresse, "NAME_VALUE" => $name, "EMAIL_VALUE" => $email, "URL_VALUE" => $url, "WOHNORT_VALUE" => $city, "TEXT_VALUE" => $text));
    // Teilseite zusammensetzen
    if (trim($danke_text) != '') {
        $danke_text_value = $t->parse("output", "danketext");
    } else {
        $danke_text_value = '';
    }
    // soll nur der Danke-Text ausgegeben werden, erstelle keine Formularseite
    if ($formular_an_aus == 0 and $Eintrag_geschrieben) {
        $formular_value = '';
    } else {
        // Teilseite zusammensetzen
        $formular_value = $t->parse("output", 'formular');
    }
    // Seite zusammensetzen
    $t->set_var(array("DANKE_TEXT" => $danke_text_value, 'FORMULAR' => $formular_value));
    /* create Template instance called $t */
    //    $t = new Template(GBOOK_TEMPLATEPATH, "remove");
    //$t->debug = 7;
    //    $start_dir = 'gb_frontend_form.html';
    /* lese Template-Datei */
    /*    $t->set_file(array("start" => $start_dir));
    
        $t->set_var(array("DANKE_TEXT_VALUE" => $danke_text,
                          "FEHLERMELDUNG_VALUE" => $error,
                          "ARTICLE_ID_VALUE" => $GLOBALS['article_id'],
                          "CLANG_VALUE" => $GLOBALS['clang'],
                          "NAME_VALUE" => $name,
                          "EMAIL_VALUE" => $email,
                          "URL_VALUE" => $url,
                          "WOHNORT_VALUE" => $city,
                          "TEXT_VALUE" => $text
                      ));
    */
    // komplette Seite ausgeben
    $t->pparse("output", "start");
}
Exemplo n.º 12
0
        if ($form_deliver_org != 'ja') {
            $mail->Body = $responsemail . $nonhtmlfooter;
        } else {
            if ("REX_VALUE[12]" == 'ja') {
                $mail->IsHTML(true);
                $mail->Body = $form_template_html . nl2br($responsemail) . '<hr/>' . nl2br($rmailbodyhtml) . $form_template_html_footer;
                $mail->AltBody = $responsemail . $rmailbody . $nonhtmlfooter;
            } else {
                $mail->Body = $responsemail . "\n-----------------------------------------------\n" . $rmailbody . $nonhtmlfooter;
            }
        }
        if (!function_exists('doppelversand2')) {
            function doppelversand2()
            {
            }
            $mail->Send();
            // Versenden an Empfänger
        }
    }
    // =================MAIL-RESPONDER-ENDE=========================
    unset($_SESSION["formcheck"]);
    //
    echo '<div class="formthanks" id="doformREX_SLICE_ID">REX_VALUE[id=6 output=html]</div>';
    $noform = 1;
} else {
    $noform = 0;
}
if ($warning_set) {
    echo '<div class="kblock forminfo">';
    echo $form_error . $dfreload;
    echo '</div>';
Exemplo n.º 13
0
    function send_mails($email_adressen, $aktuelle_id, $aufgabe, $betreff)
    {
        if ($aufgabe != '') {
            // var_dump($email_adressen);
            $mail_receiver = $email_adressen;
            // Aufgabe holen
            if ($aktuelle_id == 0) {
                $expand_query = 'ORDER BY id DESC LIMIT 1';
                $aufagen_art = 'new';
            } else {
                $expand_query = 'WHERE id = ' . $aktuelle_id;
                $aufagen_art = 'edit';
            }
            $sql_aufgabe = rex_sql::factory();
            // $sql_aufgabe->setDebug();
            $sql_aufgabe->setQuery('SELECT * FROM rex_aufgaben ' . $expand_query);
            if ($sql_aufgabe->getRows()) {
                /*
                // Eigentümer holen
                $sql_email_eigentuemer = rex_sql::factory();
                // $sql_email_eigentuemer->setDebug();
                $sql_email_eigentuemer->setQuery('SELECT email FROM rex_user WHERE id = '.$sql_aufgabe->getValue('eigentuemer').' AND email != ""');
                $mail_receiver[] = $sql_email_eigentuemer->getValue('email');
                
                // Updateuser holen
                $sql_email_updateuser = rex_sql::factory();
                // $sql_email_updateuser->setDebug();
                $sql_email_updateuser->setQuery('SELECT email FROM rex_user WHERE login = "******" AND email != ""');
                $mail_receiver[] = $sql_email_updateuser->getValue('email');
                
                // Createuser holen
                $sql_email_createuser = rex_sql::factory();
                // $sql_email_createuser->setDebug();
                $sql_email_createuser->setQuery('SELECT email FROM rex_user WHERE login = "******" AND email != ""');
                $mail_receiver[] = $sql_email_createuser->getValue('email');
                */
                // Doppelte Mail Empfänger entfernen
                $mail_adressen = '';
                $mail_adressen = array_unique($mail_receiver);
                // print_r($mail_adressen);
                // Mailinhalt
                $mail_titel = $sql_aufgabe->getValue('title');
                $mail_beschreibung = $sql_aufgabe->getValue('description');
                $mail_eigentuemer = $sql_aufgabe->getValue('responsible');
                $mail_prio = $sql_aufgabe->getValue('prio');
                $mail_status = $sql_aufgabe->getValue('status');
                $mail_creatuser = $sql_aufgabe->getValue('createuser');
                $mail_updateuser = $sql_aufgabe->getValue('updateuser');
                $mail_finaldate = $sql_aufgabe->getValue('finaldate');
                if ($mail_finaldate == '') {
                    $mail_finaldate = '--';
                }
                $sql_status_name = rex_sql::factory();
                // $sql_status_name->setDebug();
                $sql_status_name->setQuery('SELECT status FROM rex_aufgaben_status WHERE id = ' . $mail_status);
                $mail_status = $sql_status_name->getValue('status');
                $sql_eigentuemer_name = rex_sql::factory();
                $sql_eigentuemer_name->setQuery('SELECT login FROM rex_user WHERE id = ' . $mail_eigentuemer);
                $mail_eigentuemer = $sql_eigentuemer_name->getValue('login');
                if (rex_addon::get('textile')->isAvailable()) {
                    $text_beschreibung = str_replace('<br />', '', $mail_beschreibung);
                    $text_beschreibung = rex_textile::parse($text_beschreibung);
                    $text_beschreibung = str_replace('###', '&#x20;', $text_beschreibung);
                } else {
                    $text_beschreibung = str_replace(PHP_EOL, '<br/>', $mail_beschreibung);
                }
                // Mails senden
                if (count($mail_adressen) == 0) {
                    echo "<div class='alert alert-success'>Es wurde keine E-Mail versendet.</div><br/>";
                } else {
                    foreach ($mail_adressen as $email_adresse) {
                        // E-Mail Adresse nochmal prüfen
                        $sql_email_pruefung = rex_sql::factory();
                        // $sql_email_pruefung->setDebug();
                        $sql_email_pruefung->setQuery('SELECT email FROM rex_user WHERE email = "' . $email_adresse . '"');
                        if ($sql_email_pruefung->getRows() > 0) {
                            $mail = new rex_mailer();
                            $body = '
              <table style="border-collapse:collapse;border-spacing:0;border-color:#ccc; width: 100%; text-align: left;">
  <tr>
    <td style="font-family:Arial, sans-serif; padding:20px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#f0f0f0;font-weight:bold;vertical-align:top" colspan="4">
      <h2>' . $mail_titel . '</h2>
    </td>
  </tr>
  <tr>
    <td style="font-family:Arial, sans-serif; font-size: 14px;padding:8px 3px 8px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top" colspan="4">
      ' . $text_beschreibung . '
    </td>
  </tr>
  <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#f0f0f0;font-weight:bold;vertical-align:top" colspan="4"> </td>
  </tr>
  <tr>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top"> Prio </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top;"> <b>' . $mail_prio . '</b> </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top"> Status </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top;"> <b>' . $mail_status . '</b> </td>
  </tr>
  <tr>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top"> Zuständig </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top;"> <b>' . $mail_eigentuemer . '</b> </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top"> Erstellt von </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top;"> <b>' . $mail_creatuser . '</b> </td>
  </tr>
  <tr>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top"> Fälligkeitsdatum </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top;"> <b>' . $mail_finaldate . '</b> </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top"> Aktualisiert von </td>
    <td style="font-family:Arial, sans-serif; font-size: 12px;padding:3px 3px 3px 8px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;vertical-align:top;"> <b>' . $mail_updateuser . '</b> </td>
  </tr>
</table>';
                            $text_body = $mail_titel . "\n\n";
                            $text_body .= $mail_beschreibung . "\n\n";
                            $mail->From = "no-reply@" . $_SERVER['SERVER_NAME'];
                            $mail->FromName = $_SERVER['SERVER_NAME'];
                            $mail->Subject = $betreff . $mail_titel;
                            $mail->Body = $body;
                            $mail->AltBody = $text_body;
                            $mail->AddAddress($email_adresse, $email_adresse);
                            if (!$mail->Send()) {
                                echo "<div class='alert alert-danger'>E-Mail konnte nicht gesendet werden.</div>";
                            } else {
                                echo "<div class='alert alert-success'>E-Mail an <b>" . $email_adresse . "</b> wurde gesendet.</div>";
                            }
                        }
                    }
                }
                $mail_adressen = '';
                $mail_receiver = '';
            }
        }
    }