Add full multipart HTML document and plain-text alternate part to eliminate SpamAssassin penalty
This commit is contained in:
@@ -171,25 +171,45 @@ class ContentController extends Controller
|
|||||||
$smtpPort = config('mail.mailers.smtp.port');
|
$smtpPort = config('mail.mailers.smtp.port');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Mail::html('
|
$now = now()->format('d-m-Y H:i:s');
|
||||||
<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;">
|
$htmlContent = '<!DOCTYPE html>
|
||||||
<div style="margin-bottom: 20px;">
|
<html lang="nl">
|
||||||
<h2 style="margin: 0; color: #0f172a; font-size: 20px;">Test E-mail • Jouwdriedee.nl</h2>
|
<head>
|
||||||
<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>
|
<meta charset="UTF-8">
|
||||||
</div>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Test E-mail • Jouwdriedee.nl</title>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif; background-color: #f8fafc; margin: 0; padding: 24px;">
|
||||||
|
<div style="max-width: 600px; margin: 0 auto; background: #ffffff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 24px;">
|
||||||
|
<h2 style="margin: 0 0 8px 0; color: #0f172a; font-size: 20px;">Test E-mail • Jouwdriedee.nl</h2>
|
||||||
|
<p style="color: #64748b; font-size: 13px; margin: 0 0 16px 0;">Deze e-mail bevestigt dat de e-mailverbinding succesvol tot stand is gebracht.</p>
|
||||||
<div style="background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; font-size: 13px; color: #334155; line-height: 1.6;">
|
<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>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>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>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 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>
|
<p style="margin: 0;"><strong>Tijdstip:</strong> '.$now.'</p>
|
||||||
</div>
|
</div>
|
||||||
<p style="color: #94a3b8; font-size: 12px; margin-top: 20px;">Jouwdriedee.nl • 3D Printstudio & Webshop</p>
|
<p style="color: #94a3b8; font-size: 12px; margin-top: 20px; border-top: 1px solid #f1f5f9; padding-top: 12px;">Jouwdriedee.nl • 3D Printstudio & Webshop</p>
|
||||||
</div>
|
</div>
|
||||||
', function ($message) use ($recipient, $fromAddress, $fromName) {
|
</body>
|
||||||
|
</html>';
|
||||||
|
|
||||||
|
$plainContent = "Test E-mail • Jouwdriedee.nl\n\n"
|
||||||
|
."Deze e-mail bevestigt dat de e-mailverbinding succesvol tot stand is gebracht.\n\n"
|
||||||
|
."Ontvanger: {$recipient}\n"
|
||||||
|
."Verzendende Driver: {$defaultMailer}\n"
|
||||||
|
."SMTP Server: {$smtpHost}:{$smtpPort}\n"
|
||||||
|
."Afzender: {$fromName} <{$fromAddress}>\n"
|
||||||
|
."Tijdstip: {$now}\n\n"
|
||||||
|
.'Jouwdriedee.nl • 3D Printstudio & Webshop';
|
||||||
|
|
||||||
|
Mail::send([], [], function ($message) use ($recipient, $fromAddress, $fromName, $htmlContent, $plainContent) {
|
||||||
$message->to($recipient)
|
$message->to($recipient)
|
||||||
->from($fromAddress, $fromName)
|
->from($fromAddress, $fromName)
|
||||||
->subject('Test E-mail vanaf Jouwdriedee.nl');
|
->subject('Test E-mail vanaf Jouwdriedee.nl')
|
||||||
|
->html($htmlContent)
|
||||||
|
->text($plainContent);
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($defaultMailer === 'log') {
|
if ($defaultMailer === 'log') {
|
||||||
|
|||||||
Reference in New Issue
Block a user