Save notification time when sending email succeeded

This commit is contained in:
grandeljay 2022-06-16 20:21:42 +02:00
parent b40d745c4b
commit c019875a24
2 changed files with 12 additions and 8 deletions

View file

@ -86,9 +86,10 @@ 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 */
if (true === $success) {
$database
->query(
'UPDATE `wishlists`
@ -96,6 +97,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
WHERE `id` = ' . $wishlist['id'] . ';'
);
}
}
$response['success'] = true;
$response['email_was_sent'] = false !== $wishlist;

View file

@ -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
}
}