Performance when sendings emails

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
federico
Posts: 35
Joined: 27 Mar 2019, 17:35

Performance when sendings emails

Post by federico »

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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Performance when sendings emails

Post by atrol »

federico wrote: 20 Nov 2019, 07:57 Why emails keep sending when configuring the "g_email_send_using_cronjob = ON"? is this a bug?
It would be a bug, but I assume you did not set this option the right way / at the right place.
Please use Search before posting and read the Manual
federico
Posts: 35
Joined: 27 Mar 2019, 17:35

Re: Performance when sendings emails

Post by federico »

$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?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Performance when sendings emails

Post by atrol »

Your setting seems to be right.
federico wrote: 20 Nov 2019, 07:57 I am using the email_store function to signal the need of sending an email ..
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 ) {
Please use Search before posting and read the Manual
federico
Posts: 35
Joined: 27 Mar 2019, 17:35

Re: Performance when sendings emails

Post by federico »

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.
Post Reply