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']);
|
$user = new User($wishlist['user']);
|
||||||
$emailRequest = new Email($user->email, __('Wish request'), $mjml);
|
$emailRequest = new Email($user->email, __('Wish request'), $mjml);
|
||||||
$emailRequest->send();
|
$success = $emailRequest->send();
|
||||||
|
|
||||||
/** Save date to database */
|
/** Save date to database */
|
||||||
$database
|
if (true === $success) {
|
||||||
->query(
|
$database
|
||||||
'UPDATE `wishlists`
|
->query(
|
||||||
SET `notification_sent` = CURRENT_TIMESTAMP
|
'UPDATE `wishlists`
|
||||||
WHERE `id` = ' . $wishlist['id'] . ';'
|
SET `notification_sent` = CURRENT_TIMESTAMP
|
||||||
);
|
WHERE `id` = ' . $wishlist['id'] . ';'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Email
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function send()
|
public function send(): bool
|
||||||
{
|
{
|
||||||
global $options;
|
global $options;
|
||||||
|
|
||||||
|
@ -56,5 +56,7 @@ class Email
|
||||||
);
|
);
|
||||||
|
|
||||||
$success = mail($to, $subject, $message, $headers);
|
$success = mail($to, $subject, $message, $headers);
|
||||||
|
|
||||||
|
return $success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue