fixed small mail setting
This commit is contained in:
@@ -63,23 +63,40 @@ class MarketingController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$locale = app()->getLocale();
|
$locale = app()->getLocale();
|
||||||
$contactAddress = config('mail.contact_address', config('mail.from.address')) ?: 'admin@fotospiel.de';
|
$contactAddress = config('mail.contact_address', config('mail.from.address'));
|
||||||
|
|
||||||
Mail::raw(
|
if (! $contactAddress) {
|
||||||
__('emails.contact.body', [
|
throw ValidationException::withMessages([
|
||||||
'name' => $request->name,
|
'email' => __('marketing.contact.error_recipient_missing', [], $locale) ?: 'Anfrage derzeit nicht möglich. Bitte später erneut versuchen.',
|
||||||
'email' => $request->email,
|
]);
|
||||||
'message' => $request->message,
|
}
|
||||||
], $locale),
|
|
||||||
function ($message) use ($contactAddress, $locale) {
|
|
||||||
$message->to($contactAddress)
|
|
||||||
->subject(__('emails.contact.subject', [], $locale));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
Mail::to($request->email)
|
try {
|
||||||
->locale($locale)
|
Mail::raw(
|
||||||
->queue(new ContactConfirmation($request->name));
|
__('emails.contact.body', [
|
||||||
|
'name' => $request->name,
|
||||||
|
'email' => $request->email,
|
||||||
|
'message' => $request->message,
|
||||||
|
], $locale),
|
||||||
|
function ($message) use ($contactAddress, $locale) {
|
||||||
|
$message->to($contactAddress)
|
||||||
|
->subject(__('emails.contact.subject', [], $locale));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Mail::to($request->email)
|
||||||
|
->locale($locale)
|
||||||
|
->queue(new ContactConfirmation($request->name));
|
||||||
|
} catch (\Throwable $exception) {
|
||||||
|
Log::error('Contact form mail failed', [
|
||||||
|
'error' => $exception->getMessage(),
|
||||||
|
'code' => $exception->getCode(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => __('marketing.contact.error_send_failed', [], $locale) ?: 'Nachricht konnte nicht gesendet werden. Bitte versuche es später erneut.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->back()
|
->back()
|
||||||
|
|||||||
Reference in New Issue
Block a user