mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: allow SMTP connection test without senderEmail
This commit is contained in:
@@ -120,16 +120,18 @@ class Update extends Action
|
||||
// Validate SMTP credentials
|
||||
// Validate when the caller is explicitly enabling or hasn't expressed a preference
|
||||
// (so a credentials-only PATCH can auto-enable). Skip only when the caller is
|
||||
// explicitly keeping/turning SMTP off, or when senderEmail is not yet configured
|
||||
// (no valid From address means no connection test is possible).
|
||||
if ((\is_null($enabled) || $enabled === true) && !empty($smtp['senderEmail'] ?? '')) {
|
||||
// explicitly keeping/turning SMTP off.
|
||||
if (\is_null($enabled) || $enabled === true) {
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->isSMTP();
|
||||
|
||||
$mail->Host = $smtp['host'] ?? '';
|
||||
$mail->Port = $smtp['port'] ?? '';
|
||||
$mail->SMTPSecure = $smtp['secure'] ?? '';
|
||||
$mail->setFrom($smtp['senderEmail'], $smtp['senderName'] ?? '');
|
||||
|
||||
if (!empty($smtp['senderEmail'] ?? '')) {
|
||||
$mail->setFrom($smtp['senderEmail'], $smtp['senderName'] ?? '');
|
||||
}
|
||||
|
||||
if (!empty($smtp['username'] ?? '')) {
|
||||
$mail->SMTPAuth = true;
|
||||
|
||||
Reference in New Issue
Block a user