本文整理汇总了PHP中mailer::instanceMailer方法的典型用法代码示例。如果您正苦于以下问题:PHP mailer::instanceMailer方法的具体用法?PHP mailer::instanceMailer怎么用?PHP mailer::instanceMailer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailer
的用法示例。
在下文中一共展示了mailer::instanceMailer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendText
/**
* sendText
*
* @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 string $content default value empty
* @param array $attachs
*
* @return object $result
*/
function sendText($from = "", $target = "", $cc = "", $bcc = "", $subject = "", $content = "", $attachs = array())
{
//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 ($content === '') {
$content = 'empty';
}
$mailer->Body = $content;
$mailer->AltBody = $content;
$mailer->isHTML(false);
//Attach the required files
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;
}
}
return $result;
}