[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Stored Proc Pass in HTML file attach in Email

I need to pass in an html file and then attach it to the email what is the best way??

thanks

This is what I have working ( I just need the attachment)
CREATE PROCEDURE [dbo].[Send_Email_Html] 
	@TO_EMAIL VARCHAR(100),
	@SUBJECT VARCHAR(255),
	@BODY VARCHAR(MAX),
 
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	exec msdb.dbo.sp_send_dbmail      
				@profile_name = 'GenericEmail',
				@recipients = @TO_EMAIL, 
				@BODY_FORMAT = 'HTML',
				@body = @BODY,   
				@subject = @SUBJECT;		
 
 
END
 
 
 
GO

Open in new window

0
cstratton
Asked:
cstratton
  • 2
1 Solution
 
RiteshShahCommented:
0
 
RiteshShahCommented:
May I know why my answer has rated "C"?
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now