Hi
In our CouchCMS based application we send a lot of mails via phpMailer. Sending mails consumes a lot of time in the GUI.
I'd like to have a alternative 'send_mail' tag, e.g. 'send_mail_buffer' that has the same params as send_mail (additionally a param for the folder to write the file to), but writes all the data needed to send the mail into a json file on the server in the following format:
Then, later, a cron job would call a CouchCMS template that performs the following:
Can anybody give me a hint how to implement this via adding a tag in kfunctions.php and using the multi value variables from couch?
Regards,
Oliver
In our CouchCMS based application we send a lot of mails via phpMailer. Sending mails consumes a lot of time in the GUI.
I'd like to have a alternative 'send_mail' tag, e.g. 'send_mail_buffer' that has the same params as send_mail (additionally a param for the folder to write the file to), but writes all the data needed to send the mail into a json file on the server in the following format:
- Code: Select all
{
"timestamp":"2022-03-22 11:38:54",
"from":"sender@mail.com",
"to":"receiver@mail.com",
"cc":null,
"bcc":null,
"subject":"Subject of the email",
"html":1,
"message":"<html>....html content...</html>",
"mailserver":null
}
Then, later, a cron job would call a CouchCMS template that performs the following:
- Code: Select all
<cms:each files as='file'>
<cms:capture into='mail' is_json='1'>
<cms:embed "../logs/mail-buffer/<cms:show file />"/>
</cms:capture>
<cms:if (mail.from) && (mail.to) && (mail.subject) && (mail.message)>
<cms:send_mail from=mail.from to=mail.to cc=mail.cc bcc=mail.bcc html=mail.html subject=mail.subject>
<cms:show mail.message />
</cms:send_mail>
</cms:if>
<cms:php>
$dir = $_SERVER['DOCUMENT_ROOT'].'/logs/';
unlink($dir."<cms:show file />");
</cms:php>
</cms:each>
Can anybody give me a hint how to implement this via adding a tag in kfunctions.php and using the multi value variables from couch?
Regards,
Oliver