function sendHTMLMail($from, $to, $subject, $body) { $mail = new htmlMimeMail(); $mail->setFrom($from); $mail->setSubject($subject); $mail->setHTML($body); if (is_array($to)) { $result = $mail->send($to); } else { $result = $mail->send(array($to)); } return $result; }
function SendMail_HTML($from, $to, $subj, $body, $attach = "") { // sending email as html //global $SERVER_SOFTWARE; $mail = new htmlMimeMail(); $mail->setFrom($from); $mail->setSubject($subj); $mail->setHTML($body); $mail->setHTMLCharset('windows-1251'); $mail->setHeadCharset('windows-1251'); if (is_array($attach)) { $total = count($attach); for ($i = 0; $i < $total; $i++) { if (file_exists($attach[$i])) { $attach_data = $mail->getFile($attach[$i]); $mail->addAttachment($attach_data, basename($attach[$i]), ''); } } } elseif (file_exists($attach) && $attach != "") { $attach_data = $mail->getFile($attach); $mail->addAttachment($attach_data, basename($attach), ''); } $result = $mail->send(array($to)); return $result; }
$i++; } //end while there are line items to print out } /*end if there are order details to show on the order*/ $MailMessage .= '</table> </body> </html>'; // echo $MailMessage . "=mailMessage<br />"; if ($_SESSION['SmtpSetting'] == 0) { $result = mail($MailTo, $MailSubject, $MailMessage, $headers); } else { include 'includes/htmlMimeMail.php'; $mail = new htmlMimeMail(); $mail->setSubject($mailSubject); $mail->setHTML($MailMessage); $result = SendmailBySmtp($mail, array($MailTo)); } if ($result) { echo ' ' . _('The following E-Mail was sent to') . ' ' . $MailTo . ' :'; } echo '<html> <head> <title>' . _('Email Confirmation') . '</title> </head> <body> <table width="60%"> <tr>. <td align="center" colspan="4"><img src="' . $RootPath . '/' . $_SESSION['LogoFile'] . '" alt="Logo" width="500" height="100" align="center" border="0" /></td> </tr> <tr>
} if ($_REQUEST["attach2"]) { check_ticket('webmail'); $a2 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach2file"]); $mail->addAttachment($a2, $_REQUEST["attach2"], $_REQUEST["attach2type"]); @unlink('temp/mail_attachs/' . $_REQUEST["attach2file"]); } if ($_REQUEST["attach3"]) { check_ticket('webmail'); $a3 = $mail->getFile('temp/mail_attachs/' . $_REQUEST["attach3file"]); $mail->addAttachment($a3, $_REQUEST["attach3"], $_REQUEST["attach3type"]); @unlink('temp/mail_attachs/' . $_REQUEST["attach3file"]); } $mail->setSMTPParams($current["smtp"], $current["smtpPort"], '', $current["useAuth"], $current["username"], $current["pass"]); if (isset($_REQUEST["useHTML"]) && $_REQUEST["useHTML"] == 'on') { $mail->setHTML($_REQUEST["body"], strip_tags($_REQUEST["body"])); } else { $mail->setText($_REQUEST["body"]); } $to_array_1 = split('[, ;]', $_REQUEST["to"]); $to_array = array(); foreach ($to_array_1 as $to_1) { if (!empty($to_1)) { $to_array[] = $to_1; } } $to_array = $webmaillib->parse_nicknames($to_array); // Get email addresses not in the address book $not_contacts = $webmaillib->are_contacts($to_array, $user); if (count($not_contacts) > 0) { $smarty->assign('notcon', 'y');
function send_Messages() { include_once "lib/mail.class.php"; $conf = $this->conf(); $db = new sql(); $db->connect(); $res = $db->query("select * from subs_messages where id={$this->mid}"); $data = $db->fetch_array($res); $page = $this->page ? $this->page : 1; $res = $db->query("select * from subs_users left join subs_subscribed on subs_users.id=subs_subscribed.sid where lid={$this->id} limit " . 10 * ($page - 1) . ",10"); if ($db->num_rows($res)) { while ($user = $db->fetch_array($res)) { $i++; $text["txt"] = $data["text"]; $text["html"] = $data["html"]; if ($data["text"]) { $txt = $this->replaceMacros($conf["text"], $text, $conf, $user); } if ($data["html"]) { $html = $this->replaceMacros($conf["html"], $text, $conf, $user); } $mail = new htmlMimeMail(); $mail->setSubject($data["subj"]); $mail->setFrom($conf["email_from"]); if ($html) { $mail->setHtmlEncoding("base64"); $mail->setHTML($html, $txt, ''); } elseif ($txt && !$html) { $mail->setText($txt); } $result = $mail->send(array($user["email"])); } $page++; //echo "Location: ?chid=".$this->chid."&action=send_Messages&id=".$this->id."&mid=$this->mid&page=$page;"; header("Location: ?chid=" . $this->chid . "&action=send_Messages&id=" . $this->id . "&mid={$this->mid}&page={$page}&i={$i}"); } else { if ($this->page) { $count = 10 * ($this->page - 2) + $this->i; $_SESSION["warning"] = "Писем отправлено: {$count}"; $db->query("update subs_messages set date_sent=" . time() . " where id={$this->mid}"); } header("Location: ?chid=" . $this->chid . "&action=show_Messages&id=" . $this->id . "&w=1"); } }
eval("\$conf[email_from]=\"" . $conf["email_from"] . "\";"); $mail->setSubject($data["subj"]); $mail->setFrom($conf["email_from"]); $db->query("select subs_users.* from subs_users where email='" . $conf["test_email"] . "'"); $lid = $data["lid"]; $d = $db->fetch_array($db->result); $data["name"] = $d["name"] ? ", " . $d["name"] : ""; $e = $d["email"]; $x = $d["salt"]; if ($data["text"]) { eval("\$text=\"" . $conf["text"] . "\";"); } if ($data["html"]) { $content = $data["html"]; eval("\$html=\"" . $conf["html"] . "\";"); $mail->setHTML($html, $text, ''); } elseif ($data["text"] && !$data["html"]) { $mail->setText($text); } $result = $mail->send(array($conf["test_email"])); $i++; header("Location: ?type=mod&mod_id=2&t=m&a=v&s={$i}"); } } elseif ($t == 'u') { $bn .= " — Подписчики"; $cn .= " — Подписчики"; if ($a == 'v') { $db = new sql(); $db->connect(); $db->query("select * from subs_users order by id"); $nr = $db->num_rows($db->result);
* and attachment. This is then attached * to the second email which is plain text. * * Create the mail object. */ $mail_1 = new htmlMimeMail(); /** * This call is usually not necessary unless you're sending the final * mail via SMTP (Qmail won't send mail with bare LFs and you must * therefore use CRLF), but setting this explicitly doesnt hurt. */ $mail_1->setCrlf("\n"); /** * First email. */ $mail_1->setHTML($mail_1->getFile('example.html'), $mail_1->getFile('example.txt'), dirname(__FILE__) . '/'); /** * Add the attachment */ $mail_1->addAttachment($mail_1->getFile('example.zip'), 'example.zip', 'application/zip'); /** * Don't send this email, but use the * get_rfc822() method to assign it to a * variable. */ $mail_1->setReturnPath('*****@*****.**'); $mail_1->setFrom('John Doe <*****@*****.**>'); $mail_1->setSubject('Test attached email'); $mail = $mail_1->getRFC822(array('Nobody <*****@*****.**>')); /** * Now start a new mail, and add the first