Create email in SSRS with a Hyperlink in the body.

  • I have an SSRS report that informs users when a certain condition is met and provides a hyperlink, using the Action property of the text box, to enable them to navigate to the correct page/section.  There is
    also a need to send emails on an ad-hoc basis to the users, again using the action property of the text box, to facilitate this.  When users click on the link they, using the standard mailto: ?Subject=? Body=,
    open outlook and create a new email with the to address, subject and body being passed in the MailTo method.

    Now this works until I try to pass the hyperlink using the standard html <a> tag  "<a href="https://url/Staff/UniteRegister/Index/" & Fields!Activity_ID.Value & "?week=" + Cstr(Fields!Week_Number.Value) & """>Click Here</a>") as part of the
    body text.  No matter what I do I cannot get this to display as I'd expect e.g. The text Click Here as the hyperlink text with the URL being opened on the click event of the link. It will, instead, display the
    tags and the full URL in  the mail and not just the Text that you selected to be displayed on creating the MailTo command.

    So rather than seeing - Please Click Here, I get Please "<a href="https://url/Staff/UniteRegister/Index/"201000032584270?week=4">Click Here</a>!

    If my objectives in this task are not that clear then please get in touch and I shall elaborate as much as possible.

    Regards,
    Gordon

    Gordon Barclay

  • Be sure to modify the properties of the e-mail body to HTML first.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • I know outlook is set to compose emails in HTML, but where should i set this value please? Should i be passing the values in HTML Tags with the correct escape chars for whitespace etc?

    Gordon Barclay

  • Gordon Barclay - Friday, March 9, 2018 12:33 PM

    I know outlook is set to compose emails in HTML, but where should i set this value please? Should i be passing the values in HTML Tags with the correct escape chars for whitespace etc?

    You have to not use a simple mailto link...  that isn't capable of making such a change.   You'll need the CDO objects on the report server and custom code within the report that can call the custom code, where you can instantiate an Outlook instance and make it create a new e-mail message and change the properties of that message, and then invoke the send method after populating the recipients in a programmatic way.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Okay, I'll give it a go.  Cheers.

    Gordon Barclay

  • Gordon Barclay - Friday, March 9, 2018 1:59 PM

    Okay, I'll give it a go.  Cheers.

    Super.   Post back with your custom code if you get a chance, so that others with a similar problem can benefit from your knowledge / discoveries.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply