MessageBody text bug with hyperlinks
hello,
It doesn't appear to be possible to create/insert hyperlinks within the messageBody of a campaign/issue. I've followed the documentation for providing your own custom content.
http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/modules/working-with-email-campaigns/working-with-message-bodies/creating-the-content-of-the-message-body
If I do the following, the actual hyperlink gets pre-prended with my development machine name:
issue.MessageBody.BodyText = "<a href='www.google.com'>View</a>";
The hyperlink in the email text gets rendered as follows:
http://localhost/mysite/aa88ee3c-d13d-4751-ba3f-7538ecc6b2ca?sf=5C67D8http%3a%2f%2fwww.google.com
Has anybody encountered this? I don't understand how the value of my hyperlink that i set is being overwritten... Telerik??
thanks!
Hello Rico,
Basically the system forms the link by using your local website address and a guid, which is actually for the email campaign's statistics, which is the default functionality of the system.
Let us know if you have any other questions.
Kind regards,
Victor Velev
the Telerik team
Hi Again,
I still feel that this is a bug/deficiency. The editor for Message Bodies (for mailing lists/email campaigns) is a long text field editor -- in which you can create your own hyperlinks with the 'link' tool. These hyperlinks should be able to link out to any web address you specify -- and NOT be overwritten with anything else. From what I understand based on your response, this doesn't seem to be possible?
Hi Rico,
The reason for these links to be overwritten by Sitefinity is to track the clicks from your emails and generate reports for you. If your links point directly to the external resources, there will be no way for Sitefinity to track them. Since this is the whole point of the Email campaigns (you want everything from a campaign to be tracked), there is no way it can be disabled. Other than that, the links seem to be properly working and Sitefinity redirects to them, after saving the stat for the click.
Regards,Hi Victor,
Thanks for the info -- it makes a bit more sense to me now. I do have another question/problem --- I am currently using a message template for the body content for specific issues that are sent out for a campaign. Related to the above, if I create a hyperlink within that content, then sitefinity prepends the necessary info (for tracking purposes). Can you please help me identify what it is that the querystring parameter 'sf' is supposed to represent?
For instance, I have the following URL that is generated and directs me to the proper product page
http://localhost/MySite/aa88ee3c-d13d-4751-ba3f-7538ecc6b2ca?sf=7FA0FFF500CBhttp%3a%2f%2flocalhost%2fMySite%2fpath%2fcurrent%2fproduct-1
However, the following URL is also generated (by sitefinity) and does not render properly
http://localhost/MySite/aa88ee3c-d13d-4751-ba3f-7538ecc6b2ca?sf=1D22C6http%3a%2f%2flocalhost%2fMySite%2fpath%2fcurrent%2fproduct-1
My suspicion is due to the 'sf' value in the querystring. I do not seem to have control over these. How the first link (the one that works) was generated is within the message body of the actual issue (done using the UI within sitefinity). The second URL (the one that doesn't work) is done by me through code -- so whatever I'm doing, it's not generating me the proper id (sf value)... I hope this makes sense to you and you can provide some help on what it is I need to provide/do in order for the link in my campaigns to work properly.
Much appreciated.
Hi Victor,
Thanks for the info -- makes a bit more sense now. Can you please help clarify what the querystring parameter 'sf' represents (it is injected by sitefinity). I have a problem where it doesn't seem to be working properly for me...
This link (a hyperlink embedded in the message body of a specific issue) works properly (redirects to the proper page afterwards)
http://localhost/MySite/aa88ee3c-d13d-4751-ba3f-7538ecc6b2ca?sf=7FA0FFF500CBhttp%3a%2f%2flocalhost%2fMySite%2fpath%2fcurrent%2fproduct-1
This link (a hyperlink embedded in the message body of my message template) does not work (redirects to a blank page)
http://localhost/MySite/aa88ee3c-d13d-4751-ba3f-7538ecc6b2ca?sf=1D22C6http%3a%2f%2flocalhost%2fMySite%2fpath%2fcurrent%2fproduct-1
I believe the issue is due to the value of the 'sf' querystring param. However, I don't seem to have control over that value (would like to know what it is).
The difference appears to be how/where I set this value -- at the campaign's issue level (via the sitefinity admin UI) or through my own code at the message template (this is what I want).
Hope this makes sense to you and you can help clarify.
Hello Rico,
You are correct that the problem comes from the value of the sf parameter. It is used by Sitefinity
to track statistics about the campaign. The difference between the two links is that the second one is missing part of the value that needs to be passed. In the first case you have sf=7FA0FFF500CB which stands for sf=issue-short-idsender-short-id, while the second one is missing the sender-short-id and is like this: sf=1D22C6. From the code that you have shared i am unable to tell you where the problem stands,
but if you share us a working sample with your code, reproducing this issue we can take a look at it.
Hi Svetoslav,
Would you happen to have a code example to illustrate how I can build up my own URL that I'd like to inject into the message bodytext of a template I have, that would have these parameters properly appended to the URL? I need to be able to have a way to create my URL in the code behind, but still be able to track whether the link in the email body text is clicked. the 'Clicked' event that is part of the campaign reports...
I'm unsure as to where to get the 'sender-short-id' from...
Thanks!
Hi Rico,
Here's how the links are formed in our source:
newUrl =
string
.Concat(rootUrl, NewslettersLinkRouteHandler.linkPrefix,
"?"
, MessageEnhancer.linkQueryString,
"="
,
campaign.ShortId, subscriberShortId, HttpUtility.UrlEncode(url));
We had same problem.
We created fix by writing httpmodule:
public
class
MailiningHttpModule : IHttpModule
public
void
Dispose()
public
void
Init(HttpApplication context)
context.BeginRequest += Context_BeginRequest;
void
Context_BeginRequest(
object
sender, EventArgs e)
if
(!(sender
is
HttpApplication))
return
;
HttpApplication application = (HttpApplication)sender;
if
(sender ==
null
)
return
;
HttpContext context = application.Context;
if
(context ==
null
)
return
;
string
sf = context.Request.QueryString[
"sf"
];
string
path = context.Request.FilePath;
if
(
string
.IsNullOrEmpty(path))
return
;
path = path.Substring(1);
Guid page;
if
(!Guid.TryParse(path,
out
page))
return
;
if
(!
string
.IsNullOrEmpty(sf))
sf = sf.Substring(sf.IndexOf(
"http"
));
context.Response.Redirect(context.Server.HtmlDecode(sf));