2012-04-12 3 views
2

J'utilise sp_send_dbmail dans SQL Server 2008 pour envoyer un e-mail HTML. Je peux référence à l'image avec l'URL comme < img src = "http: ..." />Comment faire référence à une image en pièce jointe

J'ai joint l'image avec les @file_attachments. Comment faire référence à cette image en pièce jointe?

Merci

+0

Possible copie de [Peut une référence de corps de courrier électronique HTML ... une pièce jointe ...] (http://stackoverflow.com/questions/9983248/can-an-html-email-body-reference-a-file -sent-comme-une-pièce jointe-dans-le-même-email) –

+0

Je le fais dans SQL Server t-sql. Comment obtenir ce "Content-ID" ""? – Squirrel

Répondre

2
EXEC msdb.dbo.sp_send_dbmail 
    @recipients = '[email protected]', 
    @subject = 'test', 
    @file_attachments = 'C:\Test\Image.gif;C:\Test\Image2.gif', 
    @body=N'<p>Image Test</p><img src="Image.gif" /><p>See image there?</p>', 
    @body_format = 'HTML'; 

Hope qui aide.

Voici le code exact que j'ai utilisé, et cela a très bien fonctionné pour moi.

EXEC msdb.dbo.sp_send_dbmail 
    @recipients = '[email protected]', 
    @subject = 'test', 
    @profile_name = 'global config', 
    @file_attachments = 'C:\testimage.png', 
    @body=N'<p>Image Test</p><img src="testimage.png" /><p>See image there?</p>', 
    @body_format = 'HTML'; 

J'espère que cela aide.

+0

si mon @file_attachments = 'C: \ logo.png' comment devrait le Squirrel

+0

thanks. i will give it a try – Squirrel

+0

Sorry, it does not work. The image is not shown. Just a white box instead – Squirrel

Questions connexes