本文整理汇总了PHP中mailer::replaceFields方法的典型用法代码示例。如果您正苦于以下问题:PHP mailer::replaceFields方法的具体用法?PHP mailer::replaceFields怎么用?PHP mailer::replaceFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailer
的用法示例。
在下文中一共展示了mailer::replaceFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendHtml
/**
* sendHtml
*
* @param string $from default value empty
* @param string $target default value empty
* @param string $cc default value empty
* @param string $bcc default value empty
* @param string $subject default value empty
* @param array $Fields
* @param string $content default value empty
* @param array $attachs default value empty
* @param string $plainText default false
* @param boolean $returnContent default value false
*
* @return object $result
*/
function sendHtml($from = "", $target = "", $cc = "", $bcc = "", $subject = "", $Fields = array(), $content = "", $attachs = array(), $plainText = false, $returnContent = false)
{
//Replace the @@Fields with the $Fields array.
$content = mailer::replaceFields($Fields, $content);
//Create the alternative body (text only)
//$h2t =& new html2text($content);
$text = '';
//$h2t->get_text();
//Prepate el phpmailer
$mailer = mailer::instanceMailer();
$arpa = mailer::arpaEMAIL($from);
$mailer->From = $arpa['email'] == '' ? $mailer->defaultEMail : $arpa['email'];
$mailer->FromName = $arpa['name'];
$arpa = mailer::arpaEMAIL($target);
$mailer->AddAddress($arpa['email'], $arpa['name']);
$mailer->AddCC($cc);
$mailer->AddBCC($bcc);
$mailer->Subject = $subject;
if ($plainText) {
$content = $text;
}
if ($content === '') {
$content = 'empty';
}
$mailer->Body = $content;
//$mailer->AltBody = $text;
$mailer->isHTML(!$plainText);
//Attach the required files
if (is_array($attachs)) {
if (sizeof($attachs) > 0) {
foreach ($attachs as $aFile) {
$mailer->AddAttachment($aFile, basename($aFile));
}
}
}
//Send the e-mail.
for ($r = 1; $r <= 4; $r++) {
$result = $mailer->Send();
if ($result) {
break;
}
}
//unset($h2t);
if ($result && $returnContent) {
return $content;
}
return $result;
}