Created
December 20, 2013 16:47
-
-
Save peterdemartini/8057641 to your computer and use it in GitHub Desktop.
SugarCRM Send Email via PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function send_report_email($subject, $body, $emails){ | |
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->Subject = $subject; | |
$mail->Body = $body; | |
$mail->isHTML(true); | |
$mail->prepForOutbound(); | |
foreach($emails as $email) | |
$mail->AddAddress($email); | |
@$mail->Send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment