August 14, 2018 at 6:17 pm
The information in this earlier post just isn't working for me at all. It's good information and it got me started, but ultimately it isn't working.
I have a folder on my Server's C: drive that contains two files: Dashboard.pdf and Dashboard.jpg. These files are overwritten on a daily basis. All I want to do is use database mail to send the Dashboard.PDF file as an attachment and embed Dashboard.jpg in the body of the email. That's it.
The email is being sent with the files attached perfectly.
Here's the code . . .
DECLARE @body1 varchar(4000)
set @body1 = '<head>
<title> Dashboard </title>
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<table><tr><td valign="top" align="left"><img src="cid:Dashboard.jpg" border="0" alt=""></td></tr>
</table>
</body>'
EXEC msdb.dbo.sp_send_dbmail
@recipients=N'klgtest@gmail.com',
@body= @body1,
@body_format = 'HTML',
@subject = 'Dashboard',
@profile_name = 'EmailReports',
@file_attachments ='c:\Dashboard.jpg;c:\Dashboard.pdf'
Both attachments are sent and received but the jpg won't embed inside the email body. The size of the file doesn't seem to be the problem. And since the files are being sent, I don't think it's a database mail issue. I've tried some pairs of small images and nothing comes out in the body of the email.
I hope you or someone here can help.
Thanks!
Karen
August 15, 2018 at 2:36 am
Karen Grube - Tuesday, August 14, 2018 6:17 PMThe information in this earlier post just isn't working for me at all. It's good information and it got me started, but ultimately it isn't working.I have a folder on my Server's C: drive that contains two files: Dashboard.pdf and Dashboard.jpg. These files are overwritten on a daily basis. All I want to do is use database mail to send the Dashboard.PDF file as an attachment and embed Dashboard.jpg in the body of the email. That's it.
The email is being sent with the files attached perfectly.
Here's the code . . .
DECLARE @body1 varchar(4000)
set @body1 = '<head>
<title> Dashboard </title>
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<table><tr><td valign="top" align="left"><img src="cid:Dashboard.jpg" border="0" alt=""></td></tr>
</table>
</body>'EXEC msdb.dbo.sp_send_dbmail
@recipients=N'klgtest@gmail.com',
@body= @body1,
@body_format = 'HTML',
@subject = 'Dashboard',
@profile_name = 'EmailReports',
@file_attachments ='c:\Dashboard.jpg;c:\Dashboard.pdf'Both attachments are sent and received but the jpg won't embed inside the email body. The size of the file doesn't seem to be the problem. And since the files are being sent, I don't think it's a database mail issue. I've tried some pairs of small images and nothing comes out in the body of the email.
I hope you or someone here can help.
Thanks!
Karen
I know this is of little help, but I copied and pasted your code into SSMS and created files on my servers c drive Called Dashboard.jpg and dashboard.pdf and it worked fine. So there doesn't appear to be anything wrong with your code.
Regards
August 15, 2018 at 2:51 am
Actually, that does help a lot. It tells me we either have something set up differently or incorrectly in our connection to gmail's outgoing smtp server or there's some security issue somewhere blocking the image. Thank you!
August 15, 2018 at 5:48 pm
Okay, I tried sending a very small scheduled SSRS report as MHTML from our server and the report didn't display in the email client. THEN I looked at the RAW email and saw that it was being sent from our server using an old ip address set up for ipv4. I'm working with our server hosting provider to correct that to our newer ip address and we'll see if it resolves the problem. WOW! I'll let everyone know.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply