if(@tst > 0 )
begin
--write the email text
declare @etxt varchar(max)
set @etxt=''
set @etxt=@etxt+'<html>
<style type="text/css">
body {font-family:Helvetica;font-size:11pt;}
th {background-color:Navy;color:white;font-weight:bold;font-size:12pt;}
th.grid {width=100px;border:1px solid silver;font-weight:normal;font-size:10pt;}
td.grid {border:1px solid silver;font-size:10pt;}
</style>
<table width="900" border="0">
<tr>
<th align="left" style="width:900px;">My Company Reporting Services</th>
</tr>
<tr>
<td>
<span style="font-weight:bold;font-size:14pt;">Daily My Data Reports</span><br />
Please direct any questions or concerns to our help desk (help@myDomain.com).<br />
Thank you.</i>
<br />
<br />
<b>Please click the link(s) below to view current My data loaded to the system:</b><br />
<br />
<a href="https://reporting.mydomain.com/ReportViewerHTML5.aspx?ReportFile=/Entity/My%20Data.trdx&EntityID=01&ID=1982973293">Report Title 1</a>
<br />
<a href="https://reporting.mydomain.com/ReportViewerHTML5.aspx?ReportFile=/Entity/My%20Data.trdx&EntityID=01&ID=1942447321">Report Title 2</a>
<br />
<a href="https://reporting.mydomain.com/ReportViewerHTML5.aspx?ReportFile=/Entity/My%20Data.trdx&EntityID=01&ID=1386904886">Report Title 3</a>
<br />
<a href="https://reporting.mydomain.com/ReportViewerHTML5.aspx?ReportFile=/Entity/My%20Data.trdx&EntityID=01&ID=1982004289">Report Title 4</a>
<br />
<br />
<b>Reporting Workflow record counts:</b><br />
<a href="https://reporting.mydomain.com/ReportViewerHTML5.aspx?ReportFile=/Billing/ReportWFData.trdx&lookback=30">Reporting Workflow</a>
<br />
<b>Reporting Fallouts:</b><br />
<a href="https://reporting.mydomain.com/ReportViewerHTML5.aspx?ReportFile=/Billing/ReportingFallouts.trdx&showArchived=N">Reporting Fallouts</a>
</td>
</tr>
<tr>
<td style="border-top:1px solid black;text-align:right;">
<span style="font-weight:bold;font-size:10pt;">My Company Name, </span>
<span style="font-style:italic;font-size:10pt;">Maximizing Value in all we do</span>
</td>
</tr>
</table>
</html>'
set @etxt = replace(@etxt,'~BR~','<br />')
--send the email
declare @to varchar(2000)
set @to=@who
exec msdb.dbo.sp_send_dbmail
@profile_name='ReportingDB'
,@recipients=@to
,@copy_recipients='datasystems@mydomain.com'
,@subject=@msg
,@body_format='HTML'
,@body=@etxt
end
No comments:
Post a Comment