2012-04-12 13 views
2

SQL Server 2008でsp_send_dbmailを使用してHTML電子メールを送信しています。私は<のようなURLで画像を参照できます。img src = "http:..." />添付ファイルの画像への参照方法

@file_attachmentsで画像を添付しました。添付ファイルでこの画像を参照する方法は?

おかげ

+0

[HTMLメール本文参照...添付ファイル...]の可能な複製(http://stackoverflow.com/questions/9983248/can-an-html-email-body-reference-a-file -sent-as-the-same-emailとして送信されます) –

+0

私はSQL Serverのt-sqlでこれをやっています。その "Content-ID" ""を取得するには? – Squirrel

答えて

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

お役に立てば幸いです。

ここで私が使用したコードは正確ですが、それは私にとってはうまく機能しました。

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

これが役立ちます。

+0

もし私の@file_attachments = 'C:\ logo.png' 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

関連する問題