本文整理汇总了PHP中SugarPHPMailer::handleAttachments方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarPHPMailer::handleAttachments方法的具体用法?PHP SugarPHPMailer::handleAttachments怎么用?PHP SugarPHPMailer::handleAttachments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarPHPMailer
的用法示例。
在下文中一共展示了SugarPHPMailer::handleAttachments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmail
function sendEmail($emailTo, $emailSubject, $emailBody, $altemailBody, SugarBean $relatedBean = null, $attachments = array())
{
require_once 'modules/Emails/Email.php';
require_once 'include/SugarPHPMailer.php';
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
$mail->FromName = $defaults['name'];
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
$mail->Subject = from_html($emailSubject);
$mail->Body = $emailBody;
$mail->AltBody = $altemailBody;
$mail->handleAttachments($attachments);
$mail->prepForOutbound();
$mail->AddAddress($emailTo);
//now create email
if (@$mail->Send()) {
$emailObj->to_addrs = $emailTo;
$emailObj->type = 'archived';
$emailObj->deleted = '0';
$emailObj->name = $mail->Subject;
$emailObj->description = $mail->AltBody;
$emailObj->description_html = $mail->Body;
$emailObj->from_addr = $mail->From;
if ($relatedBean instanceof SugarBean && !empty($relatedBean->id)) {
$emailObj->parent_type = $relatedBean->module_dir;
$emailObj->parent_id = $relatedBean->id;
}
$emailObj->date_sent = TimeDate::getInstance()->nowDb();
$emailObj->modified_user_id = '1';
$emailObj->created_by = '1';
$emailObj->status = 'sent';
$emailObj->save();
return true;
}
return false;
}