Save notification time when sending email succeeded
This commit is contained in:
parent
b40d745c4b
commit
c019875a24
2 changed files with 12 additions and 8 deletions
|
@ -86,15 +86,17 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
|
||||
$user = new User($wishlist['user']);
|
||||
$emailRequest = new Email($user->email, __('Wish request'), $mjml);
|
||||
$emailRequest->send();
|
||||
$success = $emailRequest->send();
|
||||
|
||||
/** Save date to database */
|
||||
$database
|
||||
->query(
|
||||
'UPDATE `wishlists`
|
||||
SET `notification_sent` = CURRENT_TIMESTAMP
|
||||
WHERE `id` = ' . $wishlist['id'] . ';'
|
||||
);
|
||||
if (true === $success) {
|
||||
$database
|
||||
->query(
|
||||
'UPDATE `wishlists`
|
||||
SET `notification_sent` = CURRENT_TIMESTAMP
|
||||
WHERE `id` = ' . $wishlist['id'] . ';'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$response['success'] = true;
|
||||
|
|
|
@ -23,7 +23,7 @@ class Email
|
|||
) {
|
||||
}
|
||||
|
||||
public function send()
|
||||
public function send(): bool
|
||||
{
|
||||
global $options;
|
||||
|
||||
|
@ -56,5 +56,7 @@ class Email
|
|||
);
|
||||
|
||||
$success = mail($to, $subject, $message, $headers);
|
||||
|
||||
return $success
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue