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]
[HttpPost]
public async Task<IActionResult> SendQuestionnaire(SendQuestionnaireViewModel viewModel) public async Task<IActionResult> SendQuestionnaire(SendQuestionnaireViewModel viewModel)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
@ -497,7 +497,10 @@ namespace Web.Areas.Admin.Controllers
Headers = new Dictionary<string, string> Headers = new Dictionary<string, string>
{ {
{ "X-Priority", "1" }, { "X-Priority", "1" },
{ "Importance", "High" } { "Importance", "High" },
{ "List-Unsubscribe", "<mailto:kontakt@nvkn.dk?subject=Unsubscribe>" },
{ "List-Unsubscribe-Post", "List-Unsubscribe=One-Click" },
{ "X-Microsoft-Classification", "Personal" }
} }
}; };
@ -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) private static string GenerateEmailBody(string userName, string subject, string url, DateTime expiry)
{ {
var danishCulture = new CultureInfo("da-DK"); var danishCulture = new CultureInfo("da-DK");
@ -537,249 +544,88 @@ namespace Web.Areas.Admin.Controllers
<head> <head>
<meta charset='UTF-8'> <meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'> <meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Invitation til undersøgelse</title> <title>Spørgeskema</title>
<style> <style>
* {{ body {{
font-family: Arial, sans-serif;
font-size: 14px;
line-height: 1.4;
color: #333;
background-color: #ffffff;
margin: 0; margin: 0;
padding: 0; padding: 0;
box-sizing: border-box;
}} }}
body {{ .container {{
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; max-width: 600px;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
padding: 20px 0;
margin: 0;
line-height: 1.6;
color: #333;
}}
.email-wrapper {{
max-width: 650px;
margin: 0 auto; margin: 0 auto;
padding: 20px;
background-color: #ffffff; background-color: #ffffff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}} }}
.header {{ .header {{
background: linear-gradient(135deg, #33b3ae 0%, #141c27 100%); border-bottom: 1px solid #ccc;
color: white; padding-bottom: 10px;
padding: 30px; margin-bottom: 20px;
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;
}} }}
.content {{ .content {{
padding: 40px 30px;
}}
.greeting {{
font-size: 20px;
color: #141c27;
margin-bottom: 20px; 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 {{ .content p {{
margin: 16px 0; margin: 10px 0;
font-size: 16px;
color: #555;
line-height: 1.7;
}} }}
.cta-section {{ .link {{
text-align: center; color: #0066cc;
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 {{
text-decoration: underline; text-decoration: underline;
}} }}
.divider {{ .footer {{
height: 1px; border-top: 1px solid #ccc;
background: linear-gradient(to right, transparent, #e2e8f0, transparent); padding-top: 15px;
margin: 30px 0; margin-top: 20px;
}} font-size: 12px;
color: #666;
/* 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;
}}
}} }}
</style> </style>
</head> </head>
<body> <body>
<div class='email-wrapper'> <div class='container'>
<div class='header'> <div class='header'>
<img src='https://i.ibb.co/F4DcSKm0/Logo-For-Email.png' alt='Nærværskonsulenterne Logo' class='logo' /> <strong>Nærværskonsulenterne ApS</strong>
<h3>Nærværskonsulenterne</h1>
<p>Invitation til undersøgelse</p>
</div> </div>
<div class='content'> <div class='content'>
<div class='greeting'>Hej {userName}! 👋</div> <p>Hej {userName},</p>
<div class='subject-line'> <p>Vi håber du har det godt.</p>
{subject}
<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>Undersøgelsen tager kun 3-5 minutter at besvare:</p>
<p><a href='{url}' class='link'>{url}</a></p>
<p><strong>Vigtigt:</strong> Undersøgelsen skal besvares inden {expiryDate} kl. {expiryTime}</p>
<p>Alle svar behandles fortroligt og anonymt.</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>
<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>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>
<div class='cta-section'>
<a href='{url}' class='cta-button'>Start spørgeskema</a>
</div>
<div class='expiry-notice'>
<span class='icon'></span>
<p>Vigtigt: Skemaet udløber den {expiryDate} kl. {expiryTime}</p>
</div>
<p>Hvis du har spørgsmål eller brug for hjælp, er du velkommen til at kontakte os.</p>
<p> forhånd tak for din deltagelse!</p>
</div>
<div class='divider'></div>
<div class='footer'> <div class='footer'>
<div class='company-info'> <p>Nærværskonsulenterne ApS<br/>
<h3>Nærværskonsulenterne ApS</h3> Brødemosevej 24A, 3300 Frederiksværk<br/>
<p>Brødemosevej 24A<br/> kontakt@nvkn.dk</p>
3300 Frederiksværk<br/>
Danmark</p> <p><a href='mailto:kontakt@nvkn.dk?subject=Afmeld' style='color: #666;'>Klik her for at afmelde emails</a></p>
<br/>
<p>📧 E-mail: <a href='mailto:kontakt@nvkn.dk'>kontakt@nvkn.dk</a></p>
</div>
</div> </div>
</div> </div>
</body> </body>
@ -788,7 +634,6 @@ namespace Web.Areas.Admin.Controllers
[HttpGet] [HttpGet]
public async Task<IActionResult> ViewResponse(int id) // Pass the response ID public async Task<IActionResult> ViewResponse(int id) // Pass the response ID
{ {