2012-04-12 4 views
2

Ich verwende sp_send_dbmail in SQL Server 2008, um eine HTML-E-Mail zu senden. Ich kann verweisen auf Bild mit URL wie < img src = "http: ..." />So verweisen Sie auf ein Bild im Anhang

Ich habe das Bild mit dem @file_attachments angehängt. Wie verweisen Sie auf dieses Bild im Anhang?

Dank

+0

Mögliche Duplikate von [Kann eine HTML-E-Mail-Körper Referenz ... eine Anlage ...] (http://stackoverflow.com/questions/9983248/can-an-html-email-body-reference-a-file -ent-as-an-attachment-in-der-selben-email) –

+0

Ich mache das in SQL Server t-sql. Wie bekomme ich die "Content-ID" ""? – Squirrel

Antwort

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'; 

Hoffnung, das hilft.

Hier ist der genaue Code, den ich verwendet habe, und es funktionierte gut für mich.

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'; 

Ich hoffe, das hilft.

+0

wenn meine @file_attachments = 'C: \ logo.png' wie sollte die 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