Configure mail services for primary inbox delivery in Gmail and focused inbox in Outlook

Updated mail service settings to ensure emails are delivered to the Primary tab in Gmail and the Focused inbox in Outlook.
This commit is contained in:
Qaisyousuf 2025-08-05 17:17:06 +02:00
parent 285eb3ce93
commit 24812a77fa

View file

@ -465,7 +465,7 @@ namespace Web.Areas.Admin.Controllers
[HttpPost]
[HttpPost]
public async Task<IActionResult> SendQuestionnaire(SendQuestionnaireViewModel viewModel)
{
if (!ModelState.IsValid)
@ -495,10 +495,13 @@ namespace Web.Areas.Admin.Controllers
var emailSend = new EmailToSend(email, subject, emailBody)
{
Headers = new Dictionary<string, string>
{
{ "X-Priority", "1" },
{ "Importance", "High" }
}
{
{ "X-Priority", "1" },
{ "Importance", "High" },
{ "List-Unsubscribe", "<mailto:kontakt@nvkn.dk?subject=Unsubscribe>" },
{ "List-Unsubscribe-Post", "List-Unsubscribe=One-Click" },
{ "X-Microsoft-Classification", "Personal" }
}
};
bool emailSent = await _emailServices.SendConfirmationEmailAsync(emailSend);
@ -525,6 +528,10 @@ namespace Web.Areas.Admin.Controllers
}
// ✅ Replace your GenerateEmailBody method with this less promotional version:
// ✅ Replace your GenerateEmailBody with this VERY simple version:
private static string GenerateEmailBody(string userName, string subject, string url, DateTime expiry)
{
var danishCulture = new CultureInfo("da-DK");
@ -537,249 +544,88 @@ namespace Web.Areas.Admin.Controllers
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Invitation til undersøgelse</title>
<title>Spørgeskema</title>
<style>
* {{
body {{
font-family: Arial, sans-serif;
font-size: 14px;
line-height: 1.4;
color: #333;
background-color: #ffffff;
margin: 0;
padding: 0;
box-sizing: border-box;
}}
body {{
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
padding: 20px 0;
margin: 0;
line-height: 1.6;
color: #333;
}}
.email-wrapper {{
max-width: 650px;
.container {{
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #ffffff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}}
.header {{
background: linear-gradient(135deg, #33b3ae 0%, #141c27 100%);
color: white;
padding: 30px;
text-align: center;
}}
.logo {{
max-width: 200px;
height: auto;
margin-bottom: 15px;
filter: brightness(0) invert(1); /* Makes logo white on dark background */
}}
.header h1 {{
font-size: 28px;
font-weight: 600;
margin: 0;
text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}}
.header p {{
margin: 8px 0 0 0;
opacity: 0.9;
font-size: 16px;
border-bottom: 1px solid #ccc;
padding-bottom: 10px;
margin-bottom: 20px;
}}
.content {{
padding: 40px 30px;
}}
.greeting {{
font-size: 20px;
color: #141c27;
margin-bottom: 20px;
font-weight: 500;
}}
.subject-line {{
background: linear-gradient(135deg, #33b3ae10 0%, #33b3ae20 100%);
border-left: 4px solid #33b3ae;
padding: 20px;
margin: 20px 0;
border-radius: 8px;
font-weight: 600;
font-size: 18px;
color: #141c27;
}}
.content p {{
margin: 16px 0;
font-size: 16px;
color: #555;
line-height: 1.7;
margin: 10px 0;
}}
.cta-section {{
text-align: center;
margin: 35px 0;
padding: 20px;
}}
.cta-button {{
display: inline-block;
background: linear-gradient(135deg, #33b3ae 0%, #2a9d99 100%);
color: white;
text-decoration: none;
padding: 16px 32px;
border-radius: 50px;
font-weight: 600;
font-size: 16px;
box-shadow: 0 8px 25px rgba(51, 179, 174, 0.3);
transition: all 0.3s ease;
text-transform: uppercase;
letter-spacing: 0.5px;
}}
.cta-button:hover {{
transform: translateY(-2px);
box-shadow: 0 12px 35px rgba(51, 179, 174, 0.4);
text-decoration: none;
color: white;
}}
.expiry-notice {{
background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 30%);
border: 1px solid #feb2b2;
border-radius: 8px;
padding: 20px;
margin: 25px 0;
text-align: center;
}}
.expiry-notice .icon {{
font-size: 24px;
margin-bottom: 8px;
display: block;
}}
.expiry-notice p {{
margin: 0;
color: #c53030;
font-weight: 600;
font-size: 16px;
}}
.footer {{
background-color: #f8f9fb;
padding: 30px;
border-top: 1px solid #e2e8f0;
}}
.company-info {{
text-align: center;
color: #666;
font-size: 14px;
line-height: 1.6;
}}
.company-info h3 {{
color: #141c27;
margin-bottom: 15px;
font-size: 18px;
font-weight: 600;
}}
.company-info a {{
color: #33b3ae;
text-decoration: none;
font-weight: 500;
}}
.company-info a:hover {{
.link {{
color: #0066cc;
text-decoration: underline;
}}
.divider {{
height: 1px;
background: linear-gradient(to right, transparent, #e2e8f0, transparent);
margin: 30px 0;
}}
/* Responsive Design */
@media (max-width: 600px) {{
.email-wrapper {{
margin: 0 10px;
border-radius: 8px;
}}
.header, .content, .footer {{
padding: 20px;
}}
.logo {{
max-width: 150px;
}}
.header h1 {{
font-size: 24px;
}}
.subject-line {{
padding: 15px;
font-size: 16px;
}}
.cta-button {{
padding: 14px 28px;
font-size: 15px;
}}
.footer {{
border-top: 1px solid #ccc;
padding-top: 15px;
margin-top: 20px;
font-size: 12px;
color: #666;
}}
</style>
</head>
<body>
<div class='email-wrapper'>
<div class='container'>
<div class='header'>
<img src='https://i.ibb.co/F4DcSKm0/Logo-For-Email.png' alt='Nærværskonsulenterne Logo' class='logo' />
<h3>Nærværskonsulenterne</h1>
<p>Invitation til undersøgelse</p>
<strong>Nærværskonsulenterne ApS</strong>
</div>
<div class='content'>
<div class='greeting'>Hej {userName}! 👋</div>
<p>Hej {userName},</p>
<div class='subject-line'>
{subject}
</div>
<p>Vi håber du har det godt.</p>
<p>Du inviteres til at deltage i en kort undersøgelse fra <strong>Nærværskonsulenterne</strong> vedrørende trivsel og samarbejde arbejdspladsen.</p>
<p>Vi gennemfører en kort undersøgelse om arbejdsmiljø og trivsel arbejdspladsen. Din erfaring og feedback er meget værdifuld for os.</p>
<p>Din deltagelse er meget værdifuld for os, og vi sætter stor pris din tid og feedback. Undersøgelsen tager kun minutter at gennemføre.</p>
<p>Undersøgelsen tager kun 3-5 minutter at besvare:</p>
<div class='cta-section'>
<a href='{url}' class='cta-button'>Start spørgeskema</a>
</div>
<p><a href='{url}' class='link'>{url}</a></p>
<div class='expiry-notice'>
<span class='icon'></span>
<p>Vigtigt: Skemaet udløber den {expiryDate} kl. {expiryTime}</p>
</div>
<p><strong>Vigtigt:</strong> Undersøgelsen skal besvares inden {expiryDate} kl. {expiryTime}</p>
<p>Hvis du har spørgsmål eller brug for hjælp, er du velkommen til at kontakte os.</p>
<p>Alle svar behandles fortroligt og anonymt.</p>
<p> forhånd tak for din deltagelse!</p>
<p>Hvis du har spørgsmål, er du velkommen til at kontakte os kontakt@nvkn.dk</p>
<p> forhånd tak for din tid.</p>
<p>Med venlig hilsen,<br/>
Nærværskonsulenterne ApS</p>
</div>
<div class='divider'></div>
<div class='footer'>
<div class='company-info'>
<h3>Nærværskonsulenterne ApS</h3>
<p>Brødemosevej 24A<br/>
3300 Frederiksværk<br/>
Danmark</p>
<br/>
<p>📧 E-mail: <a href='mailto:kontakt@nvkn.dk'>kontakt@nvkn.dk</a></p>
</div>
<p>Nærværskonsulenterne ApS<br/>
Brødemosevej 24A, 3300 Frederiksværk<br/>
kontakt@nvkn.dk</p>
<p><a href='mailto:kontakt@nvkn.dk?subject=Afmeld' style='color: #666;'>Klik her for at afmelde emails</a></p>
</div>
</div>
</body>
@ -788,7 +634,6 @@ namespace Web.Areas.Admin.Controllers
[HttpGet]
public async Task<IActionResult> ViewResponse(int id) // Pass the response ID
{