sp_send_dbmail HTML with status update

  • Hi I'm working on a project that involves sending mails to people to update them about progress made.
    The thing is that I have to do it with like arrow sign posts progress bar, something like on the picture bellow

    I've tried creating a html page and embed it into the mail in SQL but outlook didn't recognize it.
    I've tried to embed a SSRS report but no luck there either.
    I've tried to create the page in sql in the @body settings for the sp_send_dbmail didn't work either.

    All I want is to show the current progress to users by sending them a mail, but I'm getting blocked.
    Is there anyone who tried something similar? or does anyone have any workaround Ideas? I could use a bit of help 🙂

    I'm using SQL2014 and Outlook2013 or 365 depending on the user if that helps at all.

    Thank you

  • You'll have to supply the details of exactly what you tried and exactly how "Outlook didn't recognize it".   One possible alternative would be to send the progress bar picture as an attachment...

  • Ok

    I have changed the names and stuff for security purposes.

    This is how I've tried to use the page and the SSRS report
    DECLARE @varsub as nvarchar(MAX) = 'Subject'
    DECLARE @tableHTML NVARCHAR(MAX);

    SET @tableHTML =
    N'
        <h1>Header</h1>
        <br />
        <br />
        <iframe src="Link to page or SSRS report"></iframe>    
    '
    EXEC msdb.dbo.sp_send_dbmail
      @profile_name = 'Profile Name',
      @recipients = N'Mail@mail.mail',
      @subject = @varsub,
      @body = @tableHTML,
      @body_format = 'HTML';

    This sent me a mail with the header but the iframe was not showing. I couldn't even see the frame, the borders I mean.

    This is how I've tried to do the page in SQL
    DECLARE @varsub as nvarchar(MAX) = 'Subject'
    DECLARE @tableHTML NVARCHAR(MAX);

    SET @tableHTML =
    N'
        <h1>Header</h1>
        <br />
        <br />
        <svg width="350" height="50">
            <path d="M50,0 h350 l25,30 l-25,30 h-350z" stroke="grey" stroke-width="1" fill="#55379b"/>
            <text fill="#FFFFFF" font-size="25" font-family="Verdana" x="65" y="39">Bla bla bla</text>
        </svg>
    '
    EXEC msdb.dbo.sp_send_dbmail
      @profile_name = 'Profile Name',
      @recipients = N'Mail@mail.mail',
      @subject = @varsub,
      @body = @tableHTML,
      @body_format = 'HTML';

    This came back with the header and the text 'Bla bla bla' (in this instance) but nothing else I couldn't see the sign post.

    and I've also tried to use CSS to create the sign posts but I lost the code for that 🙁

    Any questions let me know please, thanks

Viewing 3 posts - 1 through 2 (of 2 total)

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