2

I have developed an Event Receiver which works by sending an email to users and this email contains a link (Link to particular Page). This Email Link Generates SPACE while email is Send to users (Link with space not working).

While sending an email through Event Receiver i have tried removing spaces. for ex:

strEmailURLLink = string.Format("{0}/SitePages/HierarchyCertLevel3.aspx?CType=PAM&uid={1}&seg={2}&bs={3}&pg={4}", Web.Url.ToString().Trim(),
strThreadName.Trim().Replace(" ", string.Empty), lvSegment.LookupId.ToString().Trim(), lvBusinessScenario.LookupId.ToString().Trim(), lvProcessGroup.LookupId.ToString().Trim());

It generates space at "SitePages/HierarchyCertLevel3.asp x" (asp x) which can not be handled and when it comes to the query string it also creates the spaces but it handlable.

I have found on tricky behavior where email sending works properly with CodeBehind of page but fails while sending an email through Event Receiver.

  • I have used anchor tag in a Mail Body to navigate to the URL. what I have observed is anchor tag itself generating space in a link. Code for same is below: strMessage.Append("This activity is being facilitated through a Questionnaire. <a href='" + strEmailURLLink.Trim().Replace(" ", string.Empty) + "' target='_blank'> <b> Click Here </b> </a> to launch the Review Questionnaire "); strEmailURLLink = This variable contains the URL of page with QueryString. When I simply concat it with mail body it work properly without any spaces in a link but when i bind it with anchor tag, I didnt. – Pravin Dhulap Mar 10 '17 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.