November Happy Hour will be moved to Thursday December 5th.

alga
Sep 11, 2009
  12832
(1 votes)

Inserting an unsubscribe link into an HTML Template in EPiServerMail 4.4

In order to insert an unsubscribe link into an HTML template you can do as follows:

1) Looking at the contents of the EPiServerMail.config, you locate and copy the unsubscribeUrl value:

   1: <episerver.mail> 
   2: <sites>
   3: <site hostname="Default">
   4: <broker brokerName="" brokerHostname="episervermail.episerver.com" brokerIP="xxx.xxx.xx.xxx" />
   5: <editor defaultFromAddress="no-reply@example.com" defaultFromName="Example.com Mailing Service" goMailUrl="http://www.example.com/EPiServerMail/Public/GoMail.aspx" mailFromAddress="support@example.com" goMailImageUrl="http://www.example.com/EPiServerMail/Public/pixel.gif" encoding="iso-8859-1" editorWebServiceUrl="http://www.example.com/EPiServerMail/Public/EPiServerMailService.asmx" unsubscribeUrl="http://www.example.com/EPiServerMail/Public/Unsubscribe.aspx?rid=§recipientId§&mid=§messageId§" />
   6: <smtpServer name="smtp.example1.com" port="25" timeout="60" authMode="None" account="" password="" />
   7: </site>
   8: </sites>
   9: </episerver.mail> 

2) Then, you make a hyperlink out of the copied unsubscribeUrl value and insert it into the HTML template you have chosen.

<a href="http://www.example.com/EPiServerMail/Public/Unsubscribe.aspx?rid=§recipientId§&mid=§messageId§">Unsubscribe</a>

Additional Note) When EPiServerMail is accessing the HTML Template the remoteaddress value is the address of the CMS server.  This can be used to show/hide the unsubscribe link as necessary.

Final Note) Since EPiServer Mail 4.4 SP1 Hotfix 1, you can type §unsubscribeUrl§ in the href value instead of the value suggested above.

Disclaimer: Reasonable effort has been made by the author to ensure that the information provided here is accurate, however, no guarantees for the accuracy of information are made. You hold full responsibility for your actions - please remember to make a backup before making any changes.

Sep 11, 2009

Comments

May 22, 2013 09:26 AM

EpiServer Mail 7:
We had an issue when using the link: Avregistrera dig här.
This is probably because we changed the value of §unsubscribeUrl§ in the config file to our own custom unsubscribe URL.

However, using the url of our custom unsubscribe page instead of the §unsubscribeUrl§ worked well. Even though the two are technically identical.

Neil Perry
Neil Perry Nov 26, 2015 05:57 PM

I could not get unsubscribe to work using MVC based Razor templates e.g.

Unsubscribe

But they work ok in an .aspx template.

Are Razor .cshtml templates supported for Unsubscribe links

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog