0

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?

alwaysVBNET
  • 3,150
  • 8
  • 32
  • 65
  • 1
    I don't think `DotNetNuke.Services.Mail` replaces tokes. It just sends the mails. You have to replace them yourself. – VDWWD Oct 09 '18 at 13:45
  • @VDWWD Thanks. It does make some replacements such as User:DisplayName, but it's a different game when using the scheduler. Therefore, I am replacing them myself. – alwaysVBNET Oct 09 '18 at 16:01

0 Answers0