Hello,
I have developed a script to send multilingual emails based on a custom (very simple) template engine, but I am experimenting some performance issues.
I am using the email_store function to signal the need of sending an email, in the same way I saw how it is being done for the reporting issues, expecting this function really manages a queue. I have been reading about, and saw I have to configure a cron task to perform this with the "scripts" folder.
I have set the "$g_email_send_using_cronjob" variable to ON, expecting my emails remains on the queue (email_table) waiting for the cron task call, improving the performance of my processes, but again, this not work as expected: the emails are still being sent, and my processes continue slow.
I have already isolated the merging template process of the email template handling, to check if there was the performance problem, but it isn't. Only when I comment the "email_store" call, the process starts working fast. I have checked the db log to see if the insert message sentence is being hard, but neither.
Why emails keep sending when configuring the "g_email_send_using_cronjob = ON"? is this a bug?
or where can I find documentation or resources to make this work properly?
Thank you in adavance.
MantisBT version: 2.20.0
Schema:209
PHP:7.2.20
Database version: mariadb - 10.3.11, 10.3.11-MariaDB
Performance when sendings emails
Moderators: Developer, Contributor
Re: Performance when sendings emails
It would be a bug, but I assume you did not set this option the right way / at the right place.
Re: Performance when sendings emails
$g_email_send_using_cronjob = ON; # is set at config_inc.php where dozen of config settings are set in the same way
What it is supposed I have to assume?
What it is supposed I have to assume?
Re: Performance when sendings emails
Your setting seems to be right.
Maybe you have set $p_force true when calling the function.
Code: Select all
function email_store( $p_recipient, $p_subject, $p_message, array $p_headers = null, $p_force = false ) {
Re: Performance when sendings emails
Thank you Atrol.
I think that is is not the problem. My call is as follows:
$t_msg_subject = plugin_lang_get ('substitution_cancelled_subject');
$t_mail_to = config_get( 'from_email' );
$t_msg_body = $t_template->output();
email_store( $t_mail_to, $t_msg_subject, $t_msg_body, null, false );
And the execution delays and email is sent synchronously after the call.
I think that is is not the problem. My call is as follows:
$t_msg_subject = plugin_lang_get ('substitution_cancelled_subject');
$t_mail_to = config_get( 'from_email' );
$t_msg_body = $t_template->output();
email_store( $t_mail_to, $t_msg_subject, $t_msg_body, null, false );
And the execution delays and email is sent synchronously after the call.