Hi I have the following SQL (running on SQL 2012 STd fully patched)
DECLARE @DatabaseName VARCHAR(256)
DECLARE @Subject VARCHAR(256)
DECLARE @ParamMessageID INT
DECLARE @MessageBody NVARCHAR(MAX)
DECLARE @Attachements NVARCHAR(MAX)
SET @DatabaseName = DB_NAME()
SET @Subject = 'test email at ' + CAST(GetDate() as VARCHAR(32))
SET @MessageBody = N'hello embedded image 5' + N'<img src="logo.png" />' + ' and more text'
SET @Attachements = N'C:\temporary\logo.png;C:\temporary\logo2.png'
exec msdb.dbo.sp_send_dbmail @profile_name = @DatabaseName
, @recipients = 'someone@somedomain.co.uk'
, @copy_recipients = ''
, @blind_copy_recipients = ''
, @from_address = ''
, @reply_to = ''
, @subject = @Subject
, @body = @MessageBody
, @body_format = 'HTML'
--[ , [ @importance = ] 'importance' ]
--[ , [ @sensitivity = ] 'sensitivity' ]
, @file_attachments = @Attachements --@ParamAttachments -- ";" delimited list 1 mb per file
--[ , [ @query = ] 'query' ]
--[ , [ @execute_query_database = ] 'execute_query_database' ]
--[ , [ @attach_query_result_as_file = ] attach_query_result_as_file ]
--[ , [ @query_attachment_filename = ] query_attachment_filename ]
--[ , [ @query_result_header = ] query_result_header ]
--[ , [ @query_result_width = ] query_result_width ]
--[ , [ @query_result_separator = ] 'query_result_separator' ]
--[ , [ @exclude_query_output = ] exclude_query_output ]
--[ , [ @append_query_error = ] append_query_error ]
--[ , [ @query_no_truncate = ] query_no_truncate ]
--[ , [@query_result_no_padding = ] @query_result_no_padding ]
, @mailitem_id = @ParamMessageID OUTPUT
SELECT @ParamMessageID MessageID
I'm
fairly sure this worked in the past as I think I tested it and it is
very similar to examples out there. However the email I get back (via
gmail) is so:
hello embedded image 5<img src="logo.png" /> and more text
anyone shed any light on this please?
PS The mail is sent so it is a valid profile etc