本文整理汇总了PHP中htmlMimeMail::setHTMLCharset方法的典型用法代码示例。如果您正苦于以下问题:PHP htmlMimeMail::setHTMLCharset方法的具体用法?PHP htmlMimeMail::setHTMLCharset怎么用?PHP htmlMimeMail::setHTMLCharset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htmlMimeMail
的用法示例。
在下文中一共展示了htmlMimeMail::setHTMLCharset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public static function send($from, $to, $subject, $body, array $attachments = null, array $headers = null)
{
if (empty($to)) {
Logger::trace("mail not sent: no recipients: {$subject}");
return;
}
$config = Context::last()->config;
if (empty($from)) {
if (!($from = $config->get('modules/mail/from'))) {
$from = "Molinos.CMS <no-reply@" . MCMS_HOST_NAME . ">";
}
}
if (strstr($body, '<html>') === false) {
$body = '<html><head><title>' . html::plain($subject) . '</title></head><body>' . $body . '</body></html>';
}
if (!is_array($to)) {
$to = preg_split('/, */', $to, -1, PREG_SPLIT_NO_EMPTY);
}
Logger::log(sprintf('to=%s, subject=%s', join(',', $to), $subject), 'mail');
$mail = new htmlMimeMail();
if ('smtp' == ($transport = ($server = $config->get('modules/mail/server')) ? 'smtp' : 'mail')) {
$mail->setSMTPParams($server);
}
$mail->setFrom($from);
$mail->setSubject($subject);
$mail->setHtml(self::fixhtml($body));
$mail->setTextCharset('UTF-8');
$mail->setTextEncoding('base64');
$mail->setHTMLCharset('UTF-8');
$mail->setHTMLEncoding('UTF-8');
$mail->setHeadCharset('UTF-8');
foreach ((array) $attachments as $file) {
$mail->addAttachment($file['data'], $file['name'], $file['type']);
}
foreach ((array) $headers as $k => $v) {
if (!empty($v)) {
$mail->setHeader($k, $v);
}
}
return $mail->send($to, $transport);
}
示例2: SendMail_HTML
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;
}
示例3: die
. "WHERE " . $cFiltro . " "
. "LIMIT " . $nCuantos ;
$nResultado = mysql_query ($cSql) or die("Error en la consulta: " . $cSql . " Tipo de error: " . mysql_error());
$nFilasTot = mysql_num_rows($nResultado) ;
$nFilasAct = 0 ;
while ($aRegistro = mysql_fetch_array($nResultado)) {
$nFilasAct++ ;
$oMail = new htmlMimeMail();
$oMail->setHeader('X-Mailer', 'HTML Mime mail');
$oMail->setHeader('MIME-Version', '1.0');
// $oMail->setHeader('Content-type', 'text/html;charset=ISO-8859-9');
$oMail->setTextCharset("utf-8");
$oMail->setHTMLCharset("utf-8");
$oMail->setHeadCharset("utf-8");
$cTexto = $oMail->getFile("./Newsletter/Newsletter.txt");
$cTexto = str_replace("##Contenido##", $cContTexto, $cTexto);
$cTexto = str_replace("##Nombre##", ucwords(strtolower($aRegistro['UsrFirstName1'])), $cTexto);
$cTexto = str_replace("##EMail##", $aRegistro["UsrEMail1"], $cTexto);
$cTexto = str_replace("##Clave##", $aRegistro["UsrPassword"], $cTexto);
$cTexto = str_replace("##ClaveBaja##", md5("#".$aRegistro["UsrCode"]."#".$aRegistro["UsrEMail1"]."#"), $cTexto);
$cHTML = $oMail->getFile("./Newsletter/Newsletter.html");
$cHTML = str_replace("##Contenido##", $cContHTML, $cHTML);
$cHTML = str_replace("##Nombre##", ucwords(strtolower($aRegistro['UsrFirstName1'])), $cHTML);
$cHTML = str_replace("##EMail##", $aRegistro["UsrEMail1"], $cHTML);
$cHTML = str_replace("##Clave##", $aRegistro["UsrPassword"], $cHTML);
$cHTML = str_replace("##ClaveBaja##", md5("#".$aRegistro["UsrCode"]."#".$aRegistro["UsrEMail1"]."#"), $cHTML);