- A feature has been added to log and track outgoing emails.
- Outgoing emails are automatically recorded in a new database table named zzzzsys_email_log.
- The logging includes information about whether the email was sent successfully or encountered problems, along with all relevant details such as sender, recipient, email body, etc.
- The feature aims to help users keep track of their outgoing emails.
- It enables the identification of emails that couldn't be sent, allowing users/admins to address and fix any issues.
- The logging is triggered automatically when sending emails using the nuSendEmail() function.
- Users need to provide a second parameter, $logOptions, which is an array containing log information.
- The log options can include a 'tag' for categorisation or any other relevant information.
To make use of the new functionality, call nuSendEmail() with a 2nd parameter (array) that contains the log information.
Code: Select all
$logOptions = [
'tag' => 'some tag here'
];
$sendResult = nuSendEmail([
'to' => 'someone@test.com',
'cc' => '',
'bcc' => '',
'body' => 'email body here',
'subject' => 'test subject'
], $logOptions) ;
The default log options that are stored in the database are defined as follows:
Code: Select all
$defaultLogOptions = ['table_name' => null, 'tag' => null, 'form_id' => nuFormId(), 'user_id' => nuUserId(), 'record_id' => nuRecordId(), 'json' => null];