Developer forum

Forum » Development » Razor in ForgotPasswordTemplate

Razor in ForgotPasswordTemplate

Anders Ebdrup
Reply

Hi Dynamicweb,

 

We are having some trouble sending out html mails for ForgotPassword as we are using razor-templates.

Will it be possible to define the IsBodyHtml as a hidden input field or change the check below to test if the template name ends with "html" or "htm" then it should still work as intended for the old html-templates.



    Friend Shared Function SendForgotPasswordEmail(userEmail As String, userName As String, password As String, isNewPwd As Boolean, recoveryUrl As String, emailTemplateFolder As String, Optional emailTagVals As Dictionary(Of String, String) = Nothing) As Boolean
        Using myMail As New Mail.MailMessage()
            Dim template As String = ""
            Dim templateType As String = "txt"
            If HttpContext.Current.Request.Form("ForgotPasswordMailTemplate") <> "" Then
                template = HttpContext.Current.Request.Form("ForgotPasswordMailTemplate")
                If InStr(template, ".htm", CompareMethod.Text) > 0 OrElse InStr(template, ".html", CompareMethod.Text) > 0 Then
                    templateType = "html"
                End If
            End If

            If templateType = "txt" Then
                myMail.IsBodyHtml = False
            Else
                myMail.IsBodyHtml = True
            End If

Best regards, Anders


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

TFS#20010 for next 8.7.2 will always send the mail as HTML

Votes for this answer: 1

 

You must be logged in to post in the forum