本文整理匯總了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;
}