mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-04 08:41:50 +02:00
Some more fixes in the mail worker
This commit is contained in:
parent
d931849e1c
commit
6651e3d613
1 changed files with 10 additions and 1 deletions
|
@ -94,6 +94,7 @@ Swoole\Coroutine\run(function() use ($c, $logger, $maxRetries, $retryQueueKey) {
|
|||
if ($c['mailer'] === 'phpmailer') {
|
||||
$mail = new PHPMailer(true);
|
||||
try {
|
||||
$mail->SMTPDebug = 0;
|
||||
$mail->isSMTP();
|
||||
$mail->Host = $c['mailer_smtp_host'];
|
||||
$mail->SMTPAuth = true;
|
||||
|
@ -101,6 +102,7 @@ Swoole\Coroutine\run(function() use ($c, $logger, $maxRetries, $retryQueueKey) {
|
|||
$mail->Password = $c['mailer_smtp_password'];
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Port = $c['mailer_smtp_port'];
|
||||
|
||||
$mail->setFrom($c['mailer_from']);
|
||||
$mail->addAddress($data['toEmail']);
|
||||
$mail->Subject = $data['subject'];
|
||||
|
@ -109,7 +111,14 @@ Swoole\Coroutine\run(function() use ($c, $logger, $maxRetries, $retryQueueKey) {
|
|||
$mail->isHTML(true);
|
||||
$mail->AltBody = strip_tags($data['body']);
|
||||
}
|
||||
$mail->send();
|
||||
|
||||
Swoole\Coroutine::create(function() use ($mail) {
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Exception $e) {
|
||||
echo "Mail Error: " . $e->getMessage();
|
||||
}
|
||||
});
|
||||
} catch (PHPMailerException $e) {
|
||||
$logger->error("PHPMailer error: ", ['error' => $e->getMessage()]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue