Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
To be alerted when new user is created
#5
(08-22-2019, 09:09 AM)joebordes Wrote: let us know how it goes

Hello,

Everything is fine with this method (just after l190 in Save.php) :


Code:
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/Emails/mail.php';
$current_user = Users::getActiveAdminUser();
$to_email = 'to@somedomain.tld';
$from_name = 'Company/User name';
$from_email = 'from@yourdomain.tld';
$subject = 'Email Subject';
$content = 'Email Content';
$accountid = vtws_getEntityId('Accounts').'x74'; // 74 is an account ID in the coreBOS Tests database
$email = array(
   'saved_toid' => $to_email,
   'parent_type' => 'Accounts',
   'parent_id' => $accountid,
   'from_email' => $from_email,
   'subject' => $subject,
   'description' => $content,
);
$wsemailid = createEmailRecord($email);
list($emwsid, $emailid) = explode('x', $wsemailid);

$rdo = send_mail('HelpDesk', $to_email, $from_name, $from_email, $subject, $content, '', '', array(), $emailid);
if ($rdo != 0) {
   // Delete the $emailid record
   $focus = CRMEntity::getInstance('Emails');
   DeleteEntity('Emails', 'Emails', $focus, $emailid, $emailid);
}

Thank you.
Reply


Messages In This Thread
RE: To be alerted when new user is created - geraldbigot - 08-27-2019, 05:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)