[Vtigercrm-developers] vtiger 7.1 send email via custom function not working?
lucia digirolamo
l.digirolamo at websonica.net
Fri Jun 21 13:49:45 GMT 2019
Hi
on vtiger 6 I had a custom function (called by a workflow) that would
send email via php with the Vtiger_Mailer class. My code was the following:
$mailer = new Vtiger_Mailer();
$mailer->IsSMTP(); // send via SMTP
$mailer->IsHTML(true);
$mailer->ConfigSenderInfo($mailerfromemail,$mailerfromname,$mailerreplyto);
$mailer->AddReplyTo($mailerreplyto);
$mailer->Subject = $subject;
$mailer->Body = $message;
$mailer->AddAddress($to,$name);
$status = $mailer->Send(true);
This code on vtiger 6 works. I'm now trying to do the same thing on
vtiger 7.1 (so, I'm trying to send an email via php code on custom
function workflow) but neither Vtiger_Mailer nor send_mail() are
working. The outgoing server is working because email are being sent via
normal workflow (workflow > actions > send mail); Sendmail is working as
well because I can find it with "which sendmail" and the mail is
correctly sent from cli. The only emails that fails are the ones from
the php code of the custom function. What I have tried so far:
- Vtiger_Mailer:
require_once 'vtlib/Vtiger/Mailer.php';
global $HELPDESK_SUPPORT_EMAIL_ID;
$subject = "some subject for this email";
$description = "some content from new crm";
$mailer = new Vtiger_Mailer();
$mailer->IsHTML(true);
$mailer->ConfigSenderInfo($HELPDESK_SUPPORT_EMAIL_ID);
$mailer->Subject =$subject;
$mailer->Body = $description;
$mailer->AddAddress($myemail);
$status = $mailer->Send(true);
- sendmail:
require_once("modules/Emails/mail.php");
$module = "Potentials";
$to_email = $myemail;
$from_name = $myname;
$from_email = $fromemail;
$subject = "some subject for this email";
$contents = "some content from dieffe crm new";
$cc = "";
$bcc = "";
$attachment = "";
send_mail($module,$to_email,$from_name,$from_email,$subject,$contents,$cc,$bcc,$attachment);
Any clue on how to have this work?
More information about the vtigercrm-developers
mailing list