18f9cc2d by Marty Penner

Correct how emails are inserted into the mail daemon

1 parent 353cdaee
...@@ -269,12 +269,14 @@ function send_triggered_notification($uid = 0, $trigger = "NO_TRIGGER", $args = ...@@ -269,12 +269,14 @@ function send_triggered_notification($uid = 0, $trigger = "NO_TRIGGER", $args =
269 ); 269 );
270 270
271 $sentSuccessfully = false; 271 $sentSuccessfully = false;
272 $sentTime = '';
273 if (CBV\system_can_send_emails()) { 272 if (CBV\system_can_send_emails()) {
274 $response = \wpMandrill::mail($to_email, $subject, !empty($html) ? $html : $alttext, [], $attachments); 273 $response = \wpMandrill::mail($to_email, $subject, !empty($html) ? $html : $alttext, [], $attachments);
275 if (isset($response['status']) && !in_array($response['status'], ['rejected', 'invalid'])) { 274 if (
275 isset($response[0]['status'])
276 && isset($response[0]['status'])
277 && !in_array($response['status'], ['rejected', 'invalid'])
278 ) {
276 $sentSuccessfully = true; 279 $sentSuccessfully = true;
277 $sentTime = current_time('mysql', 1);
278 } 280 }
279 } 281 }
280 282
...@@ -291,8 +293,7 @@ function send_triggered_notification($uid = 0, $trigger = "NO_TRIGGER", $args = ...@@ -291,8 +293,7 @@ function send_triggered_notification($uid = 0, $trigger = "NO_TRIGGER", $args =
291 'attachment2' => $att2, 293 'attachment2' => $att2,
292 'attachment3' => $att3, 294 'attachment3' => $att3,
293 'sent' => (int)$sentSuccessfully, 295 'sent' => (int)$sentSuccessfully,
294 'sent_date' => $sentTime, 296 'sent_date' => ''
295 'created' => current_time('mysql', 1)
296 ], 297 ],
297 [ 298 [
298 '%d', 299 '%d',
......