Hi,
I would like to know how to make the suitecrm automatically add a cc address to the email every time the ‘Email pdf’ button is clicked.
I have found this area of code:
//subject
$email->name = $mod_strings[‘LBL_EMAIL_NAME’].’ '.$module->name;
//body
$email->description_html = $printable;
//type is draft
$email->type = “draft”;
$email->status = “draft”;
$email->cc_addrs = "name@domain.com";
I tried the method above but it does not work, any ideas?
Thanks
In which portion u made this changes ?
If you notice end of that file,
header("Location: index.php?action=Compose&module=Emails&return_module=".$module_type."&return_action=DetailView&return_id=".$_REQUEST['record']."&recordId=".$email_id);
link is there. so code is executing in this file.
Now Go to custom/modules/Emails/compose.php this generateComposeDataPackage fucntion.
Now make changes here,
Write this piece of code,
if (isset($data['to_email_addrs']) && isset($data['cc_addrs'])) {
$namePlusEmail = $data['to_email_addrs'];
$namePlusEmail = from_html(str_replace(" ", " ", $namePlusEmail));
$namePlusEmailCC = $data['cc_addrs'];
$namePlusEmailCC = from_html(str_replace(" ", " ", $namePlusEmailCC));
}
and in $ret variavble pass this parameteres,
$ret = array(
'to_email_addrs' => $namePlusEmail,
'cc_addrs' => $namePlusEmailCC,
:cheer:
Thanks.
Will this automatically add the CC only for emails generated when PDFs are created from the email pdf button? Not every email ever composed?
Hi,
I am a bit confused because there’s 2 ‘generateComposeDataPackage’ parts, can you explain in more detail where those two bits go?
Is this correct?
else if(!isset($data[‘forQuickCreate’])) {
$ret = generateComposeDataPackage($data);
$ret = array(
‘to_email_addrs’ => $namePlusEmail,
‘cc_addrs’ => $namePlusEmailCC,);
}
function generateComposeDataPackage($data,$forFullCompose = TRUE)
{
if (isset($data[‘to_email_addrs’]) && isset($data[‘cc_addrs’])) {
$namePlusEmail = $data[‘to_email_addrs’];
$namePlusEmail = from_html(str_replace(" ", " “, $namePlusEmail));
$namePlusEmailCC = $data[‘cc_addrs’];
$namePlusEmailCC = from_html(str_replace(” ", " ", $namePlusEmailCC));
}