function send_spewage($e, $to = "root@localhost") { $host = $_SERVER["SERVER_NAME"]; $from = "website@{$host}"; $subj = strtoupper("*** {$host} website exception"); mail_html($from, $to, $subj, get_spewage($e)); }
function EnvMailWN($test = false) { global $WhereComm, $headef, $indent, $Mg, $idT, $UrlRoot, $cvlibtc, $tbFormnames, $IdGAMail, $admail_expe; if ($test) { echo "<H1>Mode test !! </H1>"; echo "En mode test, on visualise les mails envoyes, mais la table n'est pas mise a jour <BR><BR>"; } echo "-----------------------------------------------------------------------<br>\n"; echo "Envois des mails d'alerte du " . date("d/m/Y", time()) . "<br>\n"; echo "liste des adresses envoyees: <br>\n"; $rep = msq("SELECT * from tx_fabformmail_abonne where 1 {$WhereComm}"); while ($rwm = mysql_fetch_array($rep)) { unset($tabposP); $nbal = 0; $nbmail = 0; $typcp = ""; $corpsAl = ""; $rwm[lastsentdate] = $rwm[lastsentdate] > 0 ? $rwm[lastsentdate] : 0; if ($rwm[typefrequence] == 28) { $rwm[typefrequence] = 30.4375; } // nbre de jours moyens dans un mois=365.25/12 $WET = " AND " . ($rwm[typeetat] == 0 ? "crdate" : "tstamp") . " >" . $rwm[lastsentdate]; if (time() >= $rwm[lastsentdate] + $rwm[typefrequence] * 24 * 3600) { // il est temps d'envoyer $tabid = explode(',', $rwm[uidpages]); foreach ($tabid as $idp) { $repWN = msq("SELECT * from tx_vm19watsniou WHERE 1 {$WhereComm} AND typcontent IN ('" . str_replace(",", "','", $rwm[typeextension]) . "') AND tabidarbo LIKE '%,{$idp},%' {$WET} ORDER BY tabidarbo,typcontent DESC, tstamp"); if (mysql_num_rows($repWN) > 0) { // YA des news dans la rub s�ectionn� while ($rwWN = mysql_fetch_array($repWN)) { $tabposC = unserialize($rwWN[tabstrarbo]); $p = 0; foreach ($tabposC as $idp => $page) { $idp = substr($idp, 2); if ($page != $tabposP[$p]) { $corpsAl .= '<a class="Tit' . ($p + 1) . '" href="' . $UrlRoot . $idp . '">' . $page . '</a>'; $typcp = ""; } $tabposP[$p] = $page; $p++; } //$tabposP=$tabposC; $corpsAl .= '<div style="margin-left:' . ($Mg + $idT + ($p - 1) * $indent) . 'px">'; if ($rwWN[typcontent] != $typcp) { $corpsAl .= '<span class="typcont">' . $cvlibtc[$rwWN[typcontent]] . '</span>'; } $typcp = $rwWN['typcontent']; if ($typcp != "vm19_hnlinks") { $href = $UrlRoot . $rwWN['pid']; $title = $rwWN['title']; } else { $tabisa = explode("|", $rwWN['title']); $href = strstr($tabisa[1], "http://") ? $tabisa[1] : "http://" . $tabisa[1]; $title = $tabisa[0]; } $corpsAl .= '<a class="titre" href="' . $href . '">' . $title . '</a>, ' . ($rwWN['tstamp'] == $rwWN['crdate'] ? " créé le " : " modifié le ") . ' ' . date("d/m/Y", $rwWN['tstamp']); $corpsAl .= "</DIV>\n"; $nbal++; } // fin boucle sur les news de la rubrique } //// fin si pas de news ds la rub } // fin boucle sur les rubriques de l'abonn� if ($nbal > 0) { // s'il y a des alarmes $nbmail++; $head = $headef . 'Vous recevrez votre prochaine alerte le ' . date("d/m/Y", time() + $rwm[typefrequence] * 24 * 3600) . "<br>"; $head .= '<FORM action="' . $UrlRoot . $rwm[pid] . '" name="fname' . $nbmail . '" method="POST"> <INPUT type="hidden" name="' . $tbFormnames['chpemail'] . '" value="' . $rwm['email'] . '">' . "\n"; //$head.='<br/>Pour gérer votre abonnement, enregistré pour l\'adresse <b>'.$rwm[email].'</b>, cliquez <a class="titre" href="javascript:document.fname'.$nbmail.'.submit()">-> ICI <- </a><br><br>'; $head .= '<br/>Pour gérer votre abonnement, enregistré pour l\'adresse <b>' . $rwm[email] . '</b>, cliquez <a class="titre" href="' . $IdGAMail . '">-> ICI <- </a><br><br>'; $head .= 'Bonne lecture ! <br><br>'; $foot = '<br/><br/>Vous recevrez votre prochaine alerte le ' . date("d/m/Y", time() + $rwm[typefrequence] * 24 * 3600) . "<br>"; $foot .= '<br/>Pour gérer votre abonnement, enregistré pour l\'adresse <b>' . $rwm[email] . '</b>, cliquez <a class="titre" href="' . $IdGAMail . '">-> ICI <- </a><br><br>'; if ($test) { echo $head . $corpsAl . $foot; echo "<hr>"; } else { echo $rwm[email] . " <br>\n"; mail_html($rwm[email], "Alerte mail du portail internet des Haras nationaux", $head . $corpsAl . $foot, $admail_expe); msq("UPDATE tx_fabformmail_abonne SET lastsentdate=" . time() . " WHERE uid=" . $rwm[uid]); } } // } // fin si temps est tel qu'il faut envoyer un mail } // fin boucle sur abonn� echo "Fin des envois du " . date("d/m/Y", time()) . "<br>\n"; }
function send_reminder($id, $event_date) { global $names, $emails, $site_extras, $debug, $only_testing, $server_url, $languages, $tzoffset, $application_name; global $EXTRA_TEXT, $EXTRA_MULTILINETEXT, $EXTRA_URL, $EXTRA_DATE, $EXTRA_EMAIL, $EXTRA_USER, $EXTRA_REMINDER, $LANGUAGE, $LOG_REMINDER; global $allow_external_users, $external_reminders; $pri[1] = translate("Low"); $pri[2] = translate("Medium"); $pri[3] = translate("High"); // get participants first... $sql = "SELECT cal_login FROM webcal_entry_user " . "WHERE cal_id = {$id} AND cal_status IN ('A','W') " . "ORDER BY cal_login"; $res = dbi_query($sql); $participants = array(); $num_participants = 0; if ($res) { while ($row = dbi_fetch_row($res)) { $participants[$num_participants++] = $row[0]; } } // get external participants $ext_participants = array(); $num_ext_participants = 0; if (!empty($allow_external_users) && $allow_external_users == "Y" && !empty($external_reminders) && $external_reminders == "Y") { $sql = "SELECT cal_fullname, cal_email FROM webcal_entry_ext_user " . "WHERE cal_id = {$id} AND cal_email IS NOT NULL " . "ORDER BY cal_fullname"; $res = dbi_query($sql); if ($res) { while ($row = dbi_fetch_row($res)) { $ext_participants[$num_ext_participants] = $row[0]; $ext_participants_email[$num_ext_participants++] = $row[1]; } } } if (!$num_participants && !$num_ext_participants) { if ($debug) { echo "No participants found for event id: {$id} <br />\n"; } return; } // get event details $res = dbi_query("SELECT cal_create_by, cal_date, cal_time, cal_mod_date, " . "cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, " . "cal_name, cal_description FROM webcal_entry WHERE cal_id = {$id}"); if (!$res) { echo "Db error: could not find event id {$id}.\n"; return; } if (!($row = dbi_fetch_row($res))) { echo "Error: could not find event id {$id} in database.\n"; return; } // send mail. we send one user at a time so that we can switch // languages between users if needed. $mailusers = array(); $recipients = array(); if ($single_user == "Y") { $mailusers[] = $emails[$single_user_login]; $recipients[] = $single_user_login; } else { for ($i = 0; $i < count($participants); $i++) { if (strlen($emails[$participants[$i]])) { $mailusers[] = $emails[$participants[$i]]; $recipients[] = $participants[$i]; } else { if ($debug) { echo "No email for user {$participants[$i]} <br />\n"; } } } for ($i = 0; $i < count($ext_participants); $i++) { $mailusers[] = $ext_participants_email[$i]; $recipients[] = $ext_participants[$i]; } } if ($debug) { echo "Found " . count($mailusers) . " with email addresses <br />\n"; } for ($j = 0; $j < count($mailusers); $j++) { $recip = $mailusers[$j]; $user = $participants[$j]; if (!empty($languages[$user])) { $userlang = $languages[$user]; } else { $userlang = $LANGUAGE; } // system default if ($userlang == "none") { $userlang = "English-US"; } // gotta pick something if ($debug) { echo "Setting language to \"{$userlang}\" <br />\n"; } reset_language($userlang); // reset timezone setting for current user if (empty($tzoffset[$user])) { $GLOBALS["TZ_OFFSET"] = 0; } else { $GLOBALS["TZ_OFFSET"] = $tzoffset[$user]; } $body = translate("This is a reminder for the event detailed below.") . "<br>\n"; $create_by = $row[0]; $name = $row[9]; $description = $row[10]; // add trailing '/' if not found in server_url /* if ( ! empty ( $server_url ) ) { if ( substr ( $server_url, -1, 1 ) == "/" ) { $body .= '<a href="'.$server_url.'view_entry.php?id='.$id.'">'.$server_url.'view_entry.php?id='.$id.'</a><br><br>'."\n\n"; } else { $body .= '<a href="'.$server_url.'/view_entry.php?id='.$id.'">'.$server_url.'/view_entry.php?id='.$id.'<a><br><br>'."\n\n"; } } */ $body .= "<h4>" . strtoupper($name) . "</h4>\n\n"; $body .= "<b>" . translate("Description") . ":</b><br>\n"; $body .= "<i>" . indent($description) . "</i><br><br>\n"; $body .= "<b>" . translate("Date") . ":</b> " . date_to_str($event_date) . "<br>\n"; if ($row[2] >= 0) { $body .= "<b>" . translate("Time") . ":</b> " . display_time($row[2]) . "<br>\n"; } if ($row[5] > 0) { $body .= "<b>" . translate("Duration") . ":</b> " . $row[5] . " " . translate("minutes") . "<br>\n"; } if (!$disable_priority_field) { $body .= "<b>" . translate("Priority") . ":</b> " . $pri[$row[6]] . "<br>\n"; } if (!$disable_access_field) { $body .= "<b>" . translate("Access") . ":</b> " . ($row[8] == "P" ? translate("Public") : translate("Confidential")) . "<br>\n"; } if (!strlen($single_user_login)) { //$body .= "<b>".translate("Created by") . ":</b> " . $row[0] . "<br>\n"; $body .= "<b>" . translate("Created by") . ":</b> " . $names[$row[0]] . "<br>\n"; } // site extra fields # $extras = get_site_extra_fields ( $id ); # for ( $i = 0; $i < count ( $site_extras ); $i++ ) { # $extra_name = $site_extras[$i][0]; # $extra_descr = $site_extras[$i][1]; # $extra_type = $site_extras[$i][2]; # if ( $extras[$extra_name]['cal_name'] != "" ) { # $body .= "<b>". translate ( $extra_descr ) . ":</b> "; # if ( $extra_type == $EXTRA_DATE ) { # $body .= date_to_str ( $extras[$extra_name]['cal_date'] ) . "<br>\n"; # } else if ( $extra_type == $EXTRA_MULTILINETEXT ) { # $body .= "\n" . indent ( $extras[$extra_name]['cal_data'] ) . "<br>\n"; # } else if ( $extra_type == $EXTRA_REMINDER ) { # //$body .= ( $extras[$extra_name]['cal_remind'] > 0 ? # // translate("Yes") : translate("No") ) . "\n"; # } else { # // default method for $EXTRA_URL, $EXTRA_TEXT, etc... # $body .= $extras[$extra_name]['cal_data'] . "<br>\n"; # } # } # } if ($single_user != "Y" && !$disable_participants_field) { $body .= "<br><b>" . translate("Participants") . ":</b><br>\n"; for ($i = 0; $i < count($participants); $i++) { $body .= " " . $names[$participants[$i]] . "<br>\n"; } for ($i = 0; $i < count($ext_participants); $i++) { $body .= " " . $ext_participants[$i] . " (" . translate("External User") . ")<br>\n"; } } $body .= '<br><a href="http://intranet/webcalendar/">http://intranet/webcalendar/</a>'; $subject = translate("Reminder") . ": " . $name; if (strlen($GLOBALS["email_fallback_from"])) { $extra_hdrs = "From: " . $GLOBALS["email_fallback_from"] . "\r\n" . "X-Mailer: " . translate($application_name); } else { $extra_hdrs = "X-Mailer: " . translate($application_name); } if ($debug) { echo "Sending mail to {$recip} (in {$userlang})\n"; } if ($only_testing) { if ($debug) { echo "<hr /><pre>To: {$recip}\nSubject: {$subject}\n{$extra_hdrs}\n\n{$body}\n\n</pre>\n"; } } else { //mail ( $recip, $subject, $body, $extra_hdrs ); mail_html($recip, $subject, $body, "*****@*****.**"); activity_log($id, "system", $user, $LOG_REMINDER, ""); } } }
/** * mode vue unique (1 seul doc) */ function singleView($content) { $this->getPersInfos(); // sert si le gonze veut recommander à un ami... a recuperer son nom et ses coordonn�s // This sets the title of the page for use in indexed search results: if ($this->internal["currentRow"]["title"]) { $GLOBALS["TSFE"]->indexedDocTitle = $this->internal["currentRow"]["title"]; } //print_r($_SESSION['art_table']); if (is_array($_SESSION['art_table'])) { foreach ($_SESSION['art_table'] as $i => $v) { if ($v == $this->getFieldContent("uid")) { $ci = $i; break; } } } //echo $ci; $this->ImgMwidth = $this->conf["Img2MaxWidth"]; $this->cHash = md5(time() . $this->internal["currentRow"]["title"]); $content = '<A name="Anc' . $this->getFieldContent("uid") . '></A>'; $content .= '<DIV class="txvm19docs_single">'; $content .= $this->RetEntete($this->internal["currentRow"]["title"]); // <H2><img src="'.$this->conf["iconDir"].'picto_documents.gif" align="middle"> '.$this->internal["currentRow"]["title"].'</H2> $content .= '<p>' . $this->getFieldLine("img2") . $this->getFieldLine("descdetail") . '</p><p> </p><div class="cartouche">' . $this->getFieldLine("ref") . $this->getFieldLine("price") . $this->getFieldLine("auteur") . $this->getFieldLine("editor") . $this->getFieldLine("technicaldegree") . $this->getFieldLine("parut") . $this->getFieldLine("support") . $this->getFieldLine("nbpages") . $this->getFieldLine("file") . '</div>' . '<br/>'; $content .= '<p align="center">'; $content .= '<span class="picto">' . str_replace('"><img', "#Anc" . $this->getFieldContent("uid") . '"><img', $this->pi_list_linkSingle($this->pi_getLL("go_back", "[go_back]"), 0)) . '</span> '; if ($_SESSION['art_table'][$ci - 1] != "") { $content .= $this->pi_list_linkSingle($this->pi_getLL("art_prec", "[art_prec]"), $_SESSION['art_table'][$ci - 1]); } $content .= " "; if ($_SESSION['art_table'][$ci + 1] != "") { $content .= $this->pi_list_linkSingle($this->pi_getLL("art_suiv", "[art_suiv]"), $_SESSION['art_table'][$ci + 1]); } $content .= '<br/>'; $content .= $this->vklink(); // lien vers cariole $urlParameters['cHash'] = $this->cHash; $urlParameters['hnkart_mode'] = "true"; $urlParameters['add_art'] = $this->internal["currentRow"]["uid"]; $content .= ' <A href="#sendaf" onclick="document.getElementById(\'sendafriend\').style.display=\'block\'">' . $this->pi_getLL("recomm", "[recomm]") . '</a>'; if ($this->internal["currentRow"]['price'] > 0) { $content .= ' <a href="' . $this->pi_getPageLink($GLOBALS["TSFE"]->id, '', $urlParameters) . '" title="' . $this->pi_getLL("add2kart", "[add2kart]") . '"><img src="' . $this->conf["iconDir"] . 'cariole.gif"/></a>'; } //print_r($_REQUEST[$this->prefixId]); $content .= '</p></DIV>' . $this->pi_getEditPanel(); $content .= '<p><FORM action="' . $this->pi_getPageLink($GLOBALS["TSFE"]->id, '', $urlParameters) . '#sendaf" name="' . $this->prefixId . 'fname" method="GET">'; // calcul des valeurs des champs, et test validite $error = false; $yourname = $_REQUEST[$this->prefixId]['yourname'] != "" ? $_REQUEST[$this->prefixId]['yourname'] : $this->personne->prenom . " " . $this->personne->nom; if ($_REQUEST[$this->prefixId]['fsent'] && $yourname == "") { $error = $this->pi_getLL("errnom"); } $yourmail = $_REQUEST[$this->prefixId]['yourmail'] != "" ? $_REQUEST[$this->prefixId]['yourmail'] : $this->personne->coordonnees->email; if ($_REQUEST[$this->prefixId]['fsent'] && (!VerifAdMail($yourmail) || $yourmail == "")) { $error .= "<br/> " . $this->pi_getLL("errmail"); } if ($_REQUEST[$this->prefixId]['fsent'] && (!VerifAdMail($_REQUEST[$this->prefixId]['mail2send']) || $_REQUEST[$this->prefixId]['mail2send'] == "")) { $error .= "<br/>" . $this->pi_getLL("errmail2send"); } $content .= '<p><a name="sendaf"></a><div id="sendafriend" style="display:' . ($_REQUEST[$this->prefixId]['fsent'] ? "block" : "none") . '"><H3>' . $this->pi_getLL("recomm", "[recomm]") . ' : </h3>'; if ($error) { $content .= '<div style="color:red">' . $error . '</div>'; } if ($_REQUEST[$this->prefixId]['fsent'] == "" || $error) { $content .= '<input type="hidden" name="' . $this->prefixId . '[fsent]" value="true"> <input type="hidden" name="' . $this->prefixId . '[showUid]" value="' . $this->getFieldContent("uid") . '"> <input type="hidden" name="' . $this->prefixId . '[ttc_uid]" value="' . $this->uid . '"> <input type="hidden" name="' . $this->prefixId . '[pointer]" value="' . $_REQUEST[$this->prefixId . '[pointer]'] . '"> <input type="hidden" name="cHash" value="' . $this->cHash . '"> <table><tr><td>' . $this->pi_getLL("yourname", "[yourname]") . ' *</td><td><input type="text" name="' . $this->prefixId . '[yourname]" size="30" value="' . $yourname . '"/></td></tr> <tr><td>' . $this->pi_getLL("yourmail", "[yourmail]") . ' *</td><td><input type="text" name="' . $this->prefixId . '[yourmail]" size="30" value="' . $yourmail . '"/></td></tr> <tr><td>' . $this->pi_getLL("mail2send", "[mail2send]") . ' *<br/><small>' . $this->pi_getLL("mail2sendcomm", "[mail2sendcomm]") . '</small></td><td> <input type="text" name="' . $this->prefixId . '[mail2send]" size="30" value="' . $_REQUEST[$this->prefixId]['mail2send'] . '"/></td></tr> <tr><td>' . $this->pi_getLL("comment", "[comment]") . '</td><td><textarea name="' . $this->prefixId . '[comment]" cols="30" rows="5">' . $_REQUEST[$this->prefixId]['comment'] . '</textarea></td></tr><tr><td> * <span class="smallred">' . $this->pi_getLL("obligchp", "[obligchp]") . '</span> </td><td><INPUT class="fxButton" type="submit" name="' . $this->prefixId . '[submit_button]" value="' . $this->pi_getLL("envoyer", "Envoyer") . '"></td></tr></table>'; } else { // marche pas car trimballe TOUS les variables GET !! //$mylink=$this->pi_list_linkSingle("produit suivant",$this->getFieldContent("uid")); $params[$this->prefixId . '[showUid]'] = $this->getFieldContent("uid"); $params[$this->prefixId . '[ttc_uid]'] = $this->uid; $mylink = "http://" . $_SERVER['SERVER_NAME'] . str_replace("index.php", "", $_SERVER['PHP_SELF']); $mylink = str_replace('href="', 'href="' . $mylink, $this->pi_linkTP("produit suivant", $params)); $mailcont = 'Bonjour,<br/><br/> Un de vos amis, ' . $_REQUEST[$this->prefixId]['yourname'] . ' (' . $_REQUEST[$this->prefixId]['yourmail'] . '), vous a transmis ce message pour vous recommander le ' . $mylink . ' sur le site des Haras nationaux, <a href="http://www.haras-nationaux.fr">www.haras-nationaux.fr</a>.'; if ($_REQUEST[$this->prefixId]['comment'] != "") { $mailcont .= ' <br/><br/>Il a ajoute ce commentaire : <br/> ' . $_REQUEST[$this->prefixId]['comment']; } $content .= 'Le message suivant a été envoyé' . $_REQUEST[$this->prefixId]['mail2send'] . ":<br/><i>"; $content .= $mailcont; $content .= '</i>'; mail_html($_REQUEST[$this->prefixId]['mail2send'], "Message de " . $_REQUEST[$this->prefixId]['yourname'], $mailcont, $_REQUEST[$this->prefixId]['yourmail']); } $content .= '</div></form></p>'; return $content; }
$flag = 1; $message_team = "<html>\r\n\t\t<body>\r\n\t\tDear Team,<br><br>\r\n\t\tA user <strong>{$from_name}</strong> submitted the abstract for <strong>OpenFOAM Symposium</strong>\n <br><br>\r\n\t\t<strong>Name:</strong> {$from_name}\n\t\t<br>\r\n\t\t<strong>Contact:</strong> {$contact_no}\n <br>\r\n\t\t<strong>Title of the abstract:</strong> {$abstract_title}\n <br> \r\n\t\t<strong>Abstract details: </strong>{$user_message}\n<br>\r\n\t\t</body>\r\n\t\t</html>"; mail_html($mailto, $from_mail, $from_name, $ccEmail, $bccEmail, $replyto, $subject, $message_team, $flag); /*********************************************************/ $flag = 0; $replto = '*****@*****.**'; // mail from address $subject = "[OpenFOAM Symposium - Test Mail] Thank you for submission\n"; $ccEmail = ''; //mail cc address $bccEmail = '*****@*****.**'; //mail bcc address $mailto = $from_mail; //mail to address $message_user = "******"; mail_html($mailto, $from_mail, $from_name, $ccEmail, $bccEmail, $replyto, $subject, $message_user, $flag); header('Location: thank-you.html'); } } function mail_html($mailto, $from_mail, $from_name, $ccEmail, $bccEmail, $replyto, $subject, $message, $flag) { if ($flag == 1) { $header .= "From: " . $from_mail . "\r\n"; $header .= "Cc: " . $ccEmail . "\r\n"; $header .= "Bcc: " . $ccEmail . "\r\n"; $header .= "Reply-To: " . $replyto . "\r\n"; $header .= "Return-Path: bounce-mail@fossee.in"; // needs to be changed acording to foss $header .= "MIME-Version: 1.0 \r\n"; $header .= "Content-type: text/html; charset=iso-8859-1 \r\n"; $header .= $message . "\r\n\r\n";
function SendCoupon($user, $code) { global $loca_lang; $old_lang = $loca_lang; // Сохранить язык пользователя, который инициировал событие рассылки loca_add("coupons", $user['lang']); // добавить языковые ключи пользователя, которому посылается сообщение и установить язык этого пользователя. $loca_lang = $user['lang']; mail_html($user['pemail'], loca("COUPON_SUBJ"), va(loca("COUPON_MESSAGE"), $user['oname'], $code), "From: coupon@" . hostname()); $loca_lang = $old_lang; // Восстановить язык пользователя }
function SendCoupon($user, $code) { global $GlobalUni; loca_add("coupons", $GlobalUni['lang']); // добавить языковые ключи пользователя, которому посылается сообщение. mail_html($user['pemail'], loca("COUPON_SUBJ"), va(loca("COUPON_MESSAGE"), $user['oname'], $code), "From: coupon@" . hostname()); }