I'm having a problem where emails sent through Sql Server are not properly being embedded in some mail clients - notably gmail and Outlook 2013 on OSX. (Outlook 2013 on PC is fine)
Here's a sample call that will demonstrate the problem in my environment:
declare @body varchar(4000)
set @body = '<head>
<title> Embedded Logo Example</title>
</head>
<body>
<table><tr><td valign="top" align="left">MyHeader</td></tr>
<tr><td valign="top" align="left"><img src="cid:logo.png" width="235" height="70" border="0" alt=""></td></tr>
</table>
</body>'
EXEC msdb.dbo.sp_send_dbmail
@profile_name='default',
@recipients='joe@email.com',
@subject = 'Test',
@body = @body,
@body_format = 'HTML',
@file_attachments = 'C:\Users\joe\Desktop\logo.png'
When I look at the source of the mail in Outlook 2013 for OSX and for Windows I can see that the "source" of the mail is different for each - so I know that the clients are doing interesting things to the files. Interestingly, when I forward the working email from Windows to OSX...It works! I took a look at the differences between the files and I can see that there is more info in the email that works (pic below) ...however, I can't see a what in sp_send_dbmail to set the content type or cid for attachments.
Does anyone know how I could specify the content type or cid, or maybe work around the issue so that it works in both sets?