本文整理汇总了PHP中SugarPHPMailer::AddStringAttachment方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarPHPMailer::AddStringAttachment方法的具体用法?PHP SugarPHPMailer::AddStringAttachment怎么用?PHP SugarPHPMailer::AddStringAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarPHPMailer
的用法示例。
在下文中一共展示了SugarPHPMailer::AddStringAttachment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: in
require_once 'include/SugarPHPMailer.php';
require_once 'modules/Emails/Email.php';
/* Query database to get case aging */
$query = 'select case_number,name,status,date_entered,description,resolveddate_c,resolution from cases,cases_cstm where cases.id=cases_cstm.id_c and account_id in ("BHP","d27f2536-ee25-29d1-fd8a-51f13a0a9eb0","a6103800-8824-1860-00a8-5140e1a5c402") and deleted=0 and (timestampdiff(day,date_entered,now())<=7 or status!="Closed") order by date_entered desc;';
$db = DBManagerFactory::getInstance();
$result = $db->query($query, true, 'BHP Weekly Report');
/* Create email bodies to send */
$emailbody = "BHP Weekly Report<br /><br />Please find the weekly report attached.";
$reportbody = "Number, Name, Status, Date Entered, Description, Date Resolved, Resolution\n";
while (($row = $db->fetchByAssoc($result)) != null) {
$reportbody .= $row['case_number'] . ", " . str_replace(array("\r", "\n", ","), '', $row['name']) . ", " . $row['status'] . ", " . $row['date_entered'] . ", " . str_replace(array("\r", "\n", ","), '', $row['description']) . ", " . $row['resolveddate_c'] . ", " . str_replace(array("\r", "\n", ","), '', $row['resolution']) . "\n";
}
/* Send out emails */
$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 = "BHP Weekly Report Draft";
$mail->IsHTML(true);
$mail->Body = $emailbody;
$mail->AltBody = $emailbody;
$mail->AddStringAttachment($reportbody, "weekly-rpt.csv");
$mail->prepForOutbound();
$mail->AddAddress('bhpteam@globalgroup.us');
$mail->Send();
/* Clean up shop */
$mail->SMTPClose();