请列出Suite CRM提供的邮件发送功能。 例如:当用户被分配到帐户时,用户会收到邮件通知。但是,当用户从帐户中删除时(在帐户'编辑'页面中,点击'分配到'旁边的' X'按钮更改用户; ,然后用户没有收到他已被删除的邮件。) 请帮帮我。
答案 0 :(得分:1)
你好我没有在suitecrm上工作我在sugarcrm上工作所以我根据suitcrm回答你的问题。
1。您必须先为其创建一个电子邮件模板。帐户模块的一个示例是在状态更改时发送电子邮件。
您可以在将logic_hook保存到帐户模块后添加。
1)在custom/modules/Accounts/logic_hooks.php
$hook_array['before_save'][] = Array(1, 'send ', 'custom/modules/Accounts/send_email.php', 'accountSendEmail', 'send_email');
2)在"send_email.php"
"custom/modules/Accounts/" folder.
的php文件
3)创建电子邮件模板表单电子邮件模块并获取其36个字符ID。
4)在custom/modules/Accounts/send_email.php
文件中写下以下代码。
class accountSendEmail{
function send_email(&$bean, $event, $arguments)
{
if (empty($bean->fetched_row)) {
require_once("include/phpmailer/class.phpmailer.php");
require_once("modules/Administration/Administration.php");
require_once("modules/EmailTemplates/EmailTemplate.php");
$emailtemplate = new EmailTemplate();
$emailtemplate = $emailtemplate->retrieve("email_template_id");
$emailtemplate->parsed_entities = null;
$temp = array();
$template_data = $emailtemplate->parse_email_template(
array(
"subject" => $emailtemplate->subject,
"body_html" => $emailtemplate->body_html,
"body" => $emailtemplate->body
),
'Accounts',
$bean,
$temp
);
$email_body = $template_data["body_html"];
$email_subject = $template_data["subject"];
$admin = new Administration();
$admin->retrieveSettings();
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $admin->settings['mail_smtpserver'];
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = $admin->settings['mail_smtpuser'];
$mail->Password = $admin->settings['mail_smtppass'];
$mail->From = $admin->settings['notify_fromaddress'];
$mail->FromName = $admin->settings['notify_fromname'];
$mail->Subject = $email_subject;
$mail->Body = from_html($email_body);
$mail->IsHTML(true);
$mail->AddAddress('your@email.address');
if (!$mail->send()) {
$GLOBALS['log']->info("Mailer error: " . $mail->ErrorInfo);
$is_send = 'notsend';
} else {
$is_send = 'send';
}
}
}
}
答案 1 :(得分:0)
// require_once('phpmalier.php');
$mail = new SugarPHPMailer();
//
// $mail->setMailerForSystem();
// $mail->From = $focus->settings['notify_fromaddress'];
// $mail->FromName = $focus->settings['notify_fromname'];
// $mail->Subject = $subject;
// $mail->IsHTML(true);
// $mail->Body = $body;//$html_body;
// $mime_type = "application/pdf";
// $mail->AddAttachment($sugar_config['upload_dir'] . $file_name.'.pdf', $file_name, 'base64', $m`enter code here`ime_type);
// $mail->prepForOutbound();
// $mail->AddAddress($To_email);
//if (!$mail->Send()) {
//$GLOBALS['log']->fatal("Email for Cases# " . $bean->name . " is not sent. Please check Email id of the contact ");
// }