Skip to content

Instantly share code, notes, and snippets.

@jmertic
Created August 6, 2012 19:51
Show Gist options
  • Save jmertic/3277953 to your computer and use it in GitHub Desktop.
Save jmertic/3277953 to your computer and use it in GitHub Desktop.
<?php
class MyHookClass
{
public function myHook(SugarBean $bean, $event, $arguments)
{
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
$mail->FromName = $defaults['name'];
$mail->Subject=from_html($bean->name);
$mail->Body=from_html("Email alert that '{$bean->name}' was saved");
$mail->prepForOutbound();
$mail->AddAddress('jmertic@sugarcrm.com');
@$mail->Send();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment