Getting the subscriber email address in an anchor tag

Kentico User asked on May 31, 2016 18:52

Hi,

I create a link in my newsletter using this C# code linkSendToFriend.HRef = string.Format("ABSURL/ForwardToAFriend.aspx?r={0}", CMS.Helpers.RequestContext.CurrentURL);

This works well but now I want to add the email address of the subscriber to the above URL. I cannot do that using this resolver {%Email|(resolver)subscriber%}

I would expect the final url to be "ABSURL/ForwardToAFriend.aspx?r=URL of the current page&email=test@email.com" when the email was sent to test@email.com

Any ideas?

Thank you,

Recent Answers


Joshua Adams answered on May 31, 2016 19:54

Where are you getting the email address from or where do you want to get it from? Is there some form on the page that the user fills out, or is it grabbing a value from their profile?

0 votesVote for this answer Mark as a Correct answer

Kentico User answered on May 31, 2016 20:04

I have set up a dynamic newsletter and the emails come from the subscriber list. The following content is present in a master page which is only used for newsletter pages.

linkSendToFriend.HRef = string.Format("ABSURL/ForwardToAFriend.aspx?r={0}", CMS.Helpers.RequestContext.CurrentURL);

The ForwardToAFriend page has 5 fields where the end user can enter 5 email addresses to send an email to them. The end user need not have to enter his own email address because he would have clicked a link in the email to come to the above page.

I am thinking if the above link can be ForwardToAFriend.aspx?r=/resources/newsletter/issue1.aspx&e=test@email.com then it will be a better user experience.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on May 31, 2016 22:12

Would a user want to send it to themselves though? Is there any requirement for them to enter their own email? Just trying to understand your requirements and process flow.

0 votesVote for this answer Mark as a Correct answer

Kentico User answered on May 31, 2016 22:28

Yes, Imagine your email address is in my newsletter subscriber list. The site's admin will trigger a dynamic newsletter to be sent out. You receive an email. Instead of using using the forward email feature, you click on a link within the newsletter to open a page where you can forward the newsletter to your friends. When you are in that forward to friend page, the site will not know who you are or your email address.

As a work around I have modified the forward your friend page by asking "your name" and "your email" i.e. the person doing the forwarding.

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on June 1, 2016 17:24

Did you actually send the newsletter to verify that the URL isn't correct? That macro won't resolve by viewing the page you are using for the dynamic newsletter, it will only resolve when the email is sent.

If it still isn't working, try changing it from {%Email|(resolver)subscriber%} to {%SubscriberEmail|(resolver)subscriber%}

0 votesVote for this answer Mark as a Correct answer

Kentico User answered on June 2, 2016 21:16

How do I use "{%SubscriberEmail|(resolver)subscriber%}" in the following C# code

linkSendToFriend.HRef = string.Format("ABSURL/ForwardToAFriend.aspx?r={0}", CMS.Helpers.RequestContext.CurrentURL);

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on June 2, 2016 23:18

Where are you using the code? If you want the email to have a link to your ForwardToAFriend.aspx, then you just need to add that macro in a static html web part or something similar.

0 votesVote for this answer Mark as a Correct answer

Kentico User answered on June 7, 2016 20:30

I am using this code in the page load method of the master page (C# code behind)

linkSendToFriend.HRef = string.Format("ABSURL/ForwardToAFriend.aspx?r={0}", CMS.Helpers.RequestContext.CurrentURL);

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.