function sendmail_tests() { $tpl = new templates(); $TEST_MAIL_SUBJECT = $_GET["TEST_MAIL_SUBJECT"]; $TEST_MAIL_FROM = $_GET["TEST_MAIL_FROM"]; $rcpt = $_GET["rcpt"]; $users = new usersMenus(); setcookie('TEST_MAIL_SUBJECT', $TEST_MAIL_SUBJECT, time() + 3600); setcookie('TEST_MAIL_FROM', $TEST_MAIL_FROM, time() + 3600); $mail = new simplemail(); $mail->addrecipient($rcpt); $mail->addreturnpath($TEST_MAIL_FROM); $mail->addfrom($TEST_MAIL_FROM); $mail->subject = $TEST_MAIL_SUBJECT; $mail->set_mode = "socket"; $mail->html = "\n\t<html>\n\t<head>{$TEST_MAIL_SUBJECT}</head>\n\t<body style='padding:20px;margin:30px'>\n\t<center>\n\t<div style='border:5px solid #005447;padding:10px;margin:5px;width:450px;text-align:left'>\n\t<H1 style='font-family:arial;font-size:18px;color:#005447'>{$TEST_MAIL_SUBJECT}</H1>\n\t<p style='font-family:arial;font-size:13px'>This is a test mail generated by artica <b>{$users->ARTICA_VERSION}</b><br>\n\tit was sended to be sure that the routing mail is available.<br>\n\t<br>\n\tYou don't need to store this mail on your Mailbox.<br>\n\t</p>\n\t<p style='font-family:arial;font-size:13px'>Please delete it</p>\n\t<hr>\n\t<p style='font-family:arial;font-size:13px;text-align:right'>The mail server administrator.</p>\n\t</div>\n\t</center>\n\t</body>\n\t</html>"; if ($mail->sendmail()) { echo $tpl->_ENGINE_parse_body("<H2>{success}</H2>"); return; } echo "<div style='color:#d32d2d'>" . nl2br($mail->error_log) . "</div>"; }
function CheckOutOfOffice($recipient, $from, $subject) { $ldap = new clladp(); $uid = $ldap->uid_from_email($recipient); if ($uid == null) { //events("unknown user $recipient from=<$from>",__FUNCTION__,__LINE__); $GLOBALS["uid"][$recipient] = "NO"; return; } else { $GLOBALS["uid"][$recipient] = $uid; } $vacation = $ldap->UserVacation($uid); if ($vacation["vacationactive"][0] != "TRUE") { if ($GLOBALS["VERBOSE"]) { events("from=<{$from}> <{$recipient}> (uid \"{$uid}\") ", __FUNCTION__, __LINE__); events("Vacation is disabled ({$vacation["vacationactive"][0]})", __FUNCTION__, __LINE__); } return; } $datefrom = $vacation["vacationstart"][0]; $dateTo = $vacation["vacationend"][0]; $DisplayName = $vacation["displayname"][0]; $vacationinfo = stripslashes($vacation["vacationinfo"][0]); $now = time(); if ($now < $datefrom) { events("Vacation not started {$datefrom}", __FUNCTION__, __LINE__); return; } if ($now >= $dateTo) { events("Vacation is finished {$dateTo}", __FUNCTION__, __LINE__); return; } $q = new mysql(); $md5 = md5("{$datefrom}{$dateTo}{$from}{$uid}"); $date = date('Y-m-d h:i:s'); $sql = "SELECT zMD5 from OutOfOffice WHERE zMD5='{$md5}' LIMIT 0,1"; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); if ($GLOBALS["VERBOSE"]) { events("zMD5={$ligne["zMD5"]} \"{$sql}\"", __FUNCTION__, __LINE__); } if ($ligne["zMD5"] != null) { events("Vacation is already sended", __FUNCTION__, __LINE__); return; } $mail = new simplemail(); $mail->addrecipient($from, $from); $mail->addfrom($recipient, $DisplayName); $mail->addsubject("Re: {$subject}"); $disctxt = br2nl($vacationinfo); $disctxt = p2nl($disctxt); $disctxt = strip_tags($disctxt); $disctxt = html_entity_decode($disctxt); $mail->text = $disctxt; $mail->html = $vacationinfo; if ($mail->sendmail()) { echo events("Auto-reply sent..", __FUNCTION__, __LINE__); } else { events("Auto-reply Error:{$mail->error_log}"); return; } $sql = "INSERT INTO OutOfOffice (zMD5,uid,zDate,mailfrom) VALUES ('{$md5}','{$uid}',NOW(),'{$from}')"; $q->QUERY_SQL($sql, "artica_events"); }
<?php // inclusion de la source de la classe include 'class.mail.php'; // creation de l'instance $mail = new simplemail(); //ajout du destinataire $mail->addrecipient('*****@*****.**', 'tetsuo'); // ajout de l'expediteur $mail->addfrom('*****@*****.**', 'gwbush'); //ajout du sujet $mail->addsubject('yyy yyy'); // le message plaintext $mail->text = 'plain text etc. etc. bla bla ...'; // envoie du message if ($mail->sendmail()) { echo "envoyé"; } else { echo "erreur"; echo $mail->error_log; }
<?php include 'class.mail.php'; $mail = new simplemail(); $mail->addrecipient('*****@*****.**', 'tetsuo'); $mail->addrecipient('*****@*****.**', 'plouf'); $mail->addbcc('*****@*****.**', 'plouf'); $mail->addfrom('*****@*****.**', 'gwbush'); $mail->addsubject('yyy yyy'); // le message text $mail->text = 'plain text etc. etc. bla bla ...'; // le message format html $mail->html = "bla<hr><img src=\"cid:doc1\" align=\"right\">blbala\n1\t2\t3\na\tb\tc"; // un attachement html ( image jointe afficher ds le html ). $mail->addhtmlattachement('KT400.gif', 'doc1', 'image/gif'); // une piece jointe. $mail->addattachement('KT400.gif'); if ($mail->sendmail()) { echo "envoyé"; } else { echo "erreur"; echo $mail->error_log; }