Fix EHLO domain for Versio Exim anti-spoofing and upgrade test email to formatted HTML
This commit is contained in:
@@ -166,12 +166,29 @@ class ContentController extends Controller
|
||||
$recipient = $validated['test_email'];
|
||||
$defaultMailer = config('mail.default');
|
||||
$fromAddress = config('mail.from.address');
|
||||
$fromName = config('mail.from.name', 'Jouwdriedee.nl');
|
||||
$smtpHost = config('mail.mailers.smtp.host');
|
||||
$smtpPort = config('mail.mailers.smtp.port');
|
||||
|
||||
try {
|
||||
Mail::raw("Dit is een test e-mail vanaf Jouwdriedee.nl om de e-mail bezorging naar {$recipient} te controleren.\n\nActieve mailer: {$defaultMailer}\nSMTP Server: {$smtpHost}:{$smtpPort}\nAfzender: {$fromAddress}\nDatum: ".now()->format('d-m-Y H:i:s'), function ($message) use ($recipient) {
|
||||
Mail::html('
|
||||
<div style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif; max-width: 600px; margin: 0 auto; padding: 24px; background: #ffffff; border-radius: 12px; border: 1px solid #e2e8f0;">
|
||||
<div style="margin-bottom: 20px;">
|
||||
<h2 style="margin: 0; color: #0f172a; font-size: 20px;">Test E-mail • Jouwdriedee.nl</h2>
|
||||
<p style="color: #64748b; font-size: 13px; margin: 4px 0 0 0;">Deze e-mail bevestigt dat de e-mailverbinding succesvol tot stand is gebracht.</p>
|
||||
</div>
|
||||
<div style="background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; font-size: 13px; color: #334155; line-height: 1.6;">
|
||||
<p style="margin: 0 0 8px 0;"><strong>Ontvanger:</strong> '.e($recipient).'</p>
|
||||
<p style="margin: 0 0 8px 0;"><strong>Verzendende Driver:</strong> '.e($defaultMailer).'</p>
|
||||
<p style="margin: 0 0 8px 0;"><strong>SMTP Server:</strong> '.e($smtpHost).':'.e($smtpPort).'</p>
|
||||
<p style="margin: 0 0 8px 0;"><strong>Afzender:</strong> '.e($fromName).' <'.e($fromAddress).'></p>
|
||||
<p style="margin: 0;"><strong>Tijdstip:</strong> '.now()->format('d-m-Y H:i:s').'</p>
|
||||
</div>
|
||||
<p style="color: #94a3b8; font-size: 12px; margin-top: 20px;">Jouwdriedee.nl • 3D Printstudio & Webshop</p>
|
||||
</div>
|
||||
', function ($message) use ($recipient, $fromAddress, $fromName) {
|
||||
$message->to($recipient)
|
||||
->from($fromAddress, $fromName)
|
||||
->subject('Test E-mail vanaf Jouwdriedee.nl');
|
||||
});
|
||||
|
||||
@@ -181,7 +198,7 @@ class ContentController extends Controller
|
||||
}
|
||||
|
||||
return redirect()->route('admin.content.index', ['tab' => 'email'])
|
||||
->with('success', "Test e-mail succesvol overhandigd aan de SMTP-server ({$smtpHost}:{$smtpPort}) voor {$recipient}! Controleer je inbox en eventueel je spamfolder.");
|
||||
->with('success', "Test e-mail succesvol overhandigd aan de SMTP-server ({$smtpHost}:{$smtpPort}) voor {$recipient}! Controleer zowel je inbox als je Spam/Ongewenst map.");
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Test mail error: '.$e->getMessage(), ['trace' => $e->getTraceAsString()]);
|
||||
|
||||
|
||||
+8
-1
@@ -47,7 +47,14 @@ return [
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', (function () {
|
||||
$host = parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST);
|
||||
if (! $host || $host === 'localhost' || $host === '127.0.0.1') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return str_starts_with($host, 'mail.') ? $host : 'mail.'.$host;
|
||||
})()),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
|
||||
Reference in New Issue
Block a user