Wygląda na to, że podczas wysyłania wiadomości e-mail za pomocą funkcji Układ, nagłówki nie zostały przetworzone i uwzględnione w wiadomości e-mail.Korzystanie z usługi Postal MVC z układem Przetwórz nagłówki jako treść wiadomości
views/maile/_ViewStart.cshtml
@{ Layout = "~/Views/Emails/_EmailLayout.cshtml"; }
views/maile/_EmailLayout.cshtml
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>ViewEmails</title>
</head>
<body>
<div>
@RenderBody()
</div>
</body>
</html>
views/maile/ResetPassword.cshtml
To: @ViewBag.To
From: @ViewBag.From
Subject: Reset Password
Views: Html
views/maile/ResetPassword.html.cshtml
Content-Type: text/html; charset=utf-8
Here is your link, etc ...
Kiedy otrzymałem pocztę wszystkie nagłówki, Od, Temat i widoki są zawarte w organizmie.
Ktoś wie, jak zrobić to poprawnie?
AKTUALIZACJA (Dzięki Andrzeja), to działa:
views/maile/_EmailLayout.cshtml
@RenderSection("Headers", false)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>ViewEmails</title>
</head>
<body>
<div>
@RenderBody()
</div>
</body>
</html>
views/maile/ResetPassword.cshtml
@section Headers {
To: @ViewBag.To
From: @ViewBag.From
Subject: Reset Password
Views: Html
}
Vi EWS/maile/ResetPassword.html.cshtml
@section Headers {
Content-Type: text/html; charset=utf-8
}
Here is your link, etc ...
Nie mogę pobrać Postal, aby rozwiązać ścieżkę do _Layout.cshtml. Czy możesz podać przykład tego? – Andrew