问题描述
我有一个存储过程用于将邮件发送到人员列表。
我已将图像存储在我的数据库中的varbinary(max)中imagetable。
我无法发送电子邮件和身体图像。
有人可以请帮助?
我尝试了什么:
尝试添加身体中的图像像..
'< a href =''someurl / newsletter.aspx /?id ='+ CAST(@ID as varchar(20) )+''+ CAST(@THEIMAGE as varchar(max))+''+'''>请点击此处填写您遗漏的详细信息';
游标如下..
开始
- 声明变量以保留电子邮件地址重新传输
DECLARE @Email varchar(255)
DECLARE @Name varchar(255)
DECLARE @ID int
DECLARE @THEIMAGE varbinary(max)
--Declare Cursor to loop通过表数据
DECLARE EmailCursor光标对于
从demoemail中选择ID,电子邮件,姓名
- 打开光标以获取电子邮件变量中的数据
打开EmailCursor
从EmailCursor获取Next到@ ID,@ Email,@ Name
while(@ @FETCH_STATUS = 0)
开始
DECLARE @out_desc varchar(1000),
@out_mesg varchar(10)
I have a stored procedure that is used to send mails to a list of people .
I have stored the image in varbinary(max) in my database in imagetable .
I am unable to send the email along with images in body .
Can anybody please help ?
What I have tried:
have tried adding the image in body like ..
'<a href=''someurl/newsletter.aspx/?id=' + CAST(@ID As varchar(20))+''+CAST(@THEIMAGE As varchar(max))+''+'''>Please click here to fill your missing details';
Cursors are as follows..
Begin
-- Declare Variable To Hold The Email Address Retrived
DECLARE @Email varchar(255)
DECLARE @Name varchar(255)
DECLARE @ID int
DECLARE @THEIMAGE varbinary(max)
--Declare Cursor to loop through the table data
DECLARE EmailCursor Cursor For
Select ID,email,name from demoemail
-- Open cursor for fetching data in email variable
open EmailCursor
Fetch Next From EmailCursor into @ID,@Email,@Name
while(@@FETCH_STATUS = 0)
Begin
DECLARE @out_desc varchar(1000),
@out_mesg varchar(10)
推荐答案
[ @file_attachments =]'file_attachments'
是一个以分号分隔的文件名列表,用于附加到电子邮件中。必须将列表中的文件指定为绝对路径。附件列表的类型为nvarchar(max)。默认情况下,数据库邮件将文件附件限制为每个文件1 MB。
[ @file_attachments= ] 'file_attachments'
Is a semicolon-delimited list of file names to attach to the e-mail message. Files in the list must be specified as absolute paths. The attachments list is of type nvarchar(max). By default, Database Mail limits file attachments to 1 MB per file.
这篇关于使用电子邮件中的存储过程发送图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!