DNN Custom Email - how to include core hyperlinks

156 Views Asked by At

I am trying to send an email and in the footer I need to include the [Unsubscribe], [SITEURL], [PORTALNAME] hyperlinks that come with some default DNN emails.

What I have done so far:

  1. I created a test.resx file under my custom module's App_LocalResources folder. In this file I have an entry MY_EMAIL_TEST.Text In this entry my html looks like:

                        <!-- // Begin Module: Standard Preheader \ -->
                        <table border="0" cellpadding="0" cellspacing="0" align="center" >
    
                            <tr>
                                <td align="center">
                                    <p>Copyright 2013 <a href="[SITEURL]">[PORTALNAME]</a> All rights reserved.</p>
                                    <p>If you wish to no longer receive emails in the future, please <a href="[UNSUBSCRIBEURL]">unsubscribe</a> here.</p>
                                </td>
                            </tr>
                        </table>
                        <!-- // End Module: Standard Preheader \ -->
                    </td>
                </tr>
            </table>
            <!-- // End Template footer \\ -->
    

    which is basically some HTML that I have copy/pasted from the EMAIL_MESSAGING_DISPATCH_BODY.Text which is in the GlobalResources.

  2. I get the string from this file like this:

    Dim body = Localization.GetSystemMessage(GetPortalSettings, "MY_EMAIL_TEST.Text", "DesktopModules/FinBidders/App_LocalResources/test.resx")
    
  3. I send the email:

     DotNetNuke.Services.Mail.Mail.SendMail(Host.HostEmail, 
     oUserInfoReceiver.Email, 
     "", "", 
     DotNetNuke.Services.Mail.MailPriority.Normal, 
     "my subject",                                                 
     DotNetNuke.Services.Mail.MailFormat.Html, 
     Text.Encoding.Default, 
     body, 
     "", Entities.Host.Host.SMTPServer, 
     Entities.Host.Host.SMTPAuthentication,
     Entities.Host.Host.SMTPUsername, Entities.Host.Host.SMTPPassword,False)
    

Notice that I specify that the format is MailFormat.Html.

Now the email I receive has NO hyperlinks to unsubscribe, portalname or siteurl. They appear as text!

Email content after it is received:

Copyright 2018 [[SITEURL]][PORTALNAME] All rights reserved.

If you wish to no longer receive emails in the future, please > [[UNSUBSCRIBEURL]]unsubscribe here.

How can these links be formatted with the proper hyperlink?

0

There are 0 best solutions below