我想使用存储过程发送电子邮件
WITH EXECUTE AS OWNER
AS
BEGIN
SET NOCOUNT ON;
DECLARE @tableCSS NVARCHAR(MAX);
DECLARE @tableHTML NVARCHAR(MAX);
SET @tableHTML =
N'<H3>RewardProgram</H3>' +
N'<table id="box-table">' +
N'<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>' +
CAST((SELECT td = WebForm.id, '',
td = WebForm.Name, '',
td = WebForm.Email, ''
FROM RewardProgram.dbo.WebForm
FOR XML PATH('tr'), TYPE) AS NVARCHAR(MAX)) +
N'</table>' +
N'<br/>'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Database Mail Profile',
@recipients = 'test@mail.com',
@subject = 'RewardProgram',
@body = @tableHTML,
@body_format = 'HTML'
END
当我执行时,命令已成功完成但未收到任何邮件
我该如何去做?
提前致谢!
编辑:在将代码移入存储过程
之前,已经设置并测试了数据库邮件答案 0 :(得分:0)
我设法在使用以下内容为我的数据库创建if( "Prod".equals(stage) )
callBankFunction ( creditCardInput )
else
callMockBankFunction ( creditCardInput )
Logger.log( creditCardInput )
和LOGIN
后发送电子邮件:
USER