修复:增强 SMTP 连通性测试容错,加入 10 秒超时限制避免端口不通导致页面死锁,并捕获 Throwable 防止致命异常
This commit is contained in:
@@ -77,7 +77,7 @@ class SmtpController extends Controller
|
||||
});
|
||||
|
||||
return redirect()->route('admin.smtp.edit')->with('success', "测试邮件已成功发送至 {$testEmail},请注意查收。");
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
return redirect()->route('admin.smtp.edit')->with('error', "测试发出失败,原因:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
'encryption' => $smtpConfig->get('smtp_encryption', 'ssl'),
|
||||
'username' => $smtpConfig->get('smtp_username'),
|
||||
'password' => $smtpConfig->get('smtp_password'),
|
||||
'timeout' => null,
|
||||
'timeout' => 10,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user