fix: smtp encryption
This commit is contained in:
@@ -66,17 +66,24 @@ class EmailChannel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($emailSettings->smtp_enabled) {
|
if ($emailSettings->smtp_enabled) {
|
||||||
|
$encryption = match (strtolower($emailSettings->smtp_encryption)) {
|
||||||
|
'starttls' => null,
|
||||||
|
'tls' => 'tls',
|
||||||
|
'none' => null,
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
|
|
||||||
config()->set('mail.default', 'smtp');
|
config()->set('mail.default', 'smtp');
|
||||||
config()->set('mail.mailers.smtp', [
|
config()->set('mail.mailers.smtp', [
|
||||||
'transport' => 'smtp',
|
'transport' => 'smtp',
|
||||||
'host' => $emailSettings->smtp_host,
|
'host' => $emailSettings->smtp_host,
|
||||||
'port' => $emailSettings->smtp_port,
|
'port' => $emailSettings->smtp_port,
|
||||||
'encryption' => $emailSettings->smtp_encryption === 'none' ? null : $emailSettings->smtp_encryption,
|
'encryption' => $encryption,
|
||||||
'username' => $emailSettings->smtp_username,
|
'username' => $emailSettings->smtp_username,
|
||||||
'password' => $emailSettings->smtp_password,
|
'password' => $emailSettings->smtp_password,
|
||||||
'timeout' => $emailSettings->smtp_timeout,
|
'timeout' => $emailSettings->smtp_timeout,
|
||||||
'local_domain' => null,
|
'local_domain' => null,
|
||||||
'auto_tls' => $emailSettings->smtp_encryption === 'none' ? '0' : '',
|
'auto_tls' => $emailSettings->smtp_encryption === 'none' ? '0' : '', // If encryption is "none", it will not try to upgrade to TLS via StartTLS to make sure it is unencrypted.
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,17 +67,26 @@ function set_transanctional_email_settings(?InstanceSettings $settings = null):
|
|||||||
|
|
||||||
return 'resend';
|
return 'resend';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$encryption = match (strtolower(data_get($settings, 'smtp_encryption'))) {
|
||||||
|
'starttls' => null,
|
||||||
|
'tls' => 'tls',
|
||||||
|
'none' => null,
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
|
|
||||||
if (data_get($settings, 'smtp_enabled')) {
|
if (data_get($settings, 'smtp_enabled')) {
|
||||||
config()->set('mail.default', 'smtp');
|
config()->set('mail.default', 'smtp');
|
||||||
config()->set('mail.mailers.smtp', [
|
config()->set('mail.mailers.smtp', [
|
||||||
'transport' => 'smtp',
|
'transport' => 'smtp',
|
||||||
'host' => data_get($settings, 'smtp_host'),
|
'host' => data_get($settings, 'smtp_host'),
|
||||||
'port' => data_get($settings, 'smtp_port'),
|
'port' => data_get($settings, 'smtp_port'),
|
||||||
'encryption' => data_get($settings, 'smtp_encryption'),
|
'encryption' => $encryption,
|
||||||
'username' => data_get($settings, 'smtp_username'),
|
'username' => data_get($settings, 'smtp_username'),
|
||||||
'password' => data_get($settings, 'smtp_password'),
|
'password' => data_get($settings, 'smtp_password'),
|
||||||
'timeout' => data_get($settings, 'smtp_timeout'),
|
'timeout' => data_get($settings, 'smtp_timeout'),
|
||||||
'local_domain' => null,
|
'local_domain' => null,
|
||||||
|
'auto_tls' => data_get($settings, 'smtp_encryption') === 'none' ? '0' : '', // If encryption is "none", it will not try to upgrade to TLS via StartTLS to make sure it is unencrypted.
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return 'smtp';
|
return 'smtp';
|
||||||
|
Reference in New Issue
Block a user