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