fix: form address
This commit is contained in:
parent
135a298080
commit
eac7834083
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
class EmailChannel
|
class EmailChannel
|
||||||
{
|
{
|
||||||
private bool $isResend = false;
|
|
||||||
public function send(SendsEmail $notifiable, Notification $notification): void
|
public function send(SendsEmail $notifiable, Notification $notification): void
|
||||||
{
|
{
|
||||||
$this->bootConfigs($notifiable);
|
$this->bootConfigs($notifiable);
|
||||||
@ -20,33 +19,14 @@ public function send(SendsEmail $notifiable, Notification $notification): void
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mailMessage = $notification->toMail($notifiable);
|
$mailMessage = $notification->toMail($notifiable);
|
||||||
// if ($this->isResend) {
|
|
||||||
Mail::send(
|
Mail::send(
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
fn (Message $message) => $message
|
fn (Message $message) => $message
|
||||||
->from(
|
|
||||||
data_get($notifiable, 'smtp_from_address'),
|
|
||||||
data_get($notifiable, 'smtp_from_name'),
|
|
||||||
)
|
|
||||||
->to($recepients)
|
->to($recepients)
|
||||||
->subject($mailMessage->subject)
|
->subject($mailMessage->subject)
|
||||||
->html((string)$mailMessage->render())
|
->html((string)$mailMessage->render())
|
||||||
);
|
);
|
||||||
// } else {
|
|
||||||
// Mail::send(
|
|
||||||
// [],
|
|
||||||
// [],
|
|
||||||
// fn (Message $message) => $message
|
|
||||||
// ->from(
|
|
||||||
// data_get($notifiable, 'smtp_from_address'),
|
|
||||||
// data_get($notifiable, 'smtp_from_name'),
|
|
||||||
// )
|
|
||||||
// ->bcc($recepients)
|
|
||||||
// ->subject($mailMessage->subject)
|
|
||||||
// ->html((string)$mailMessage->render())
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function bootConfigs($notifiable): void
|
private function bootConfigs($notifiable): void
|
||||||
@ -56,13 +36,11 @@ private function bootConfigs($notifiable): void
|
|||||||
if (!$type) {
|
if (!$type) {
|
||||||
throw new Exception('No email settings found.');
|
throw new Exception('No email settings found.');
|
||||||
}
|
}
|
||||||
if ($type === 'resend') {
|
|
||||||
$this->isResend = true;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
config()->set('mail.from.address', data_get($notifiable, 'smtp_from_address'));
|
||||||
|
config()->set('mail.from.name', data_get($notifiable, 'smtp_from_name'));
|
||||||
if (data_get($notifiable, 'resend_enabled')) {
|
if (data_get($notifiable, 'resend_enabled')) {
|
||||||
$this->isResend = true;
|
|
||||||
config()->set('mail.default', 'resend');
|
config()->set('mail.default', 'resend');
|
||||||
config()->set('resend.api_key', data_get($notifiable, 'resend_api_key'));
|
config()->set('resend.api_key', data_get($notifiable, 'resend_api_key'));
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,8 @@ function set_transanctional_email_settings(InstanceSettings | null $settings = n
|
|||||||
if (!$settings) {
|
if (!$settings) {
|
||||||
$settings = InstanceSettings::get();
|
$settings = InstanceSettings::get();
|
||||||
}
|
}
|
||||||
|
config()->set('mail.from.address', data_get($settings, 'smtp_from_address'));
|
||||||
|
config()->set('mail.from.name', data_get($settings, 'smtp_from_name'));
|
||||||
if (data_get($settings, 'resend_enabled')) {
|
if (data_get($settings, 'resend_enabled')) {
|
||||||
config()->set('mail.default', 'resend');
|
config()->set('mail.default', 'resend');
|
||||||
config()->set('resend.api_key', data_get($settings, 'resend_api_key'));
|
config()->set('resend.api_key', data_get($settings, 'resend_api_key'));
|
||||||
|
Loading…
Reference in New Issue
Block a user