question

artistlover avatar image
artistlover asked

using dbmail can you add logo somehow?

i need to add logo to emails i am sending. They currently have file attachments that will not change.
dbmail
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

This web site runs off of votes. Can you please indicate all helpful answers below by clicking on the thumbs up next to those answers. If any one answer lead to a solution, please indicate that by clicking on the check mark next to that one answer.
0 Likes 0 ·
Tom Staab avatar image
Tom Staab answered
Using sp_send_dbmail, you can include attachments and/or HTML. How are you creating and sending the email? Edited after more details provided: If you can send email using HTML (use @body_format='HTML' when calling sp_send_dbmail), you might be able to encode the image in base64. I did some searching and found a website called [A Blue Star][1] that will generate an HTML img tag with embedded base64 code from an uploaded image file. I tested it with a SQL Server logo and got it to work. I tried posting the sample here, and it made my whole answer disappear. [1]: http://www.abluestar.com/utilities/encode_base64/index.php
6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

EXEC msdb.dbo.sp_send_dbmail @profile_name = ' DB Mail New', @recipients = 'xx, @body = .', @subject = 'Regional Compliance Report', @file_attachments ='\\snap4\SHARE1\gm\MonthlyEmailedReports\RegionalComplianceReport1012-10-2014.xlsx', @body_format=' ASK-ssc-logo.gif' This errors on me.
0 Likes 0 ·
ok I changed it to 'HTML' and it sends but where do I put the image information.
0 Likes 0 ·
ok I added it to @body ...and I know I'm getting close. However, there was no image just red x.
0 Likes 0 ·
The image tag should be in the body, and the body format should be HTML. Is that what you have? I tried it (after configuring my SQL Server Database Mail to use one of my GMail accounts), but it's removing the embedded image. I'll keep playing with it.
0 Likes 0 ·
I was able to attach a logo (or anything else) as an attachment, but I can't get an embedded image to work. Sorry. After a couple of hours researching and testing, sadly, I am giving up. Thank you for the challenge, though. Because of this question, I now have my home SQL Server environment configured to send emails. :)
0 Likes 0 ·
Show more comments
artistlover avatar image
artistlover answered
stored procedure select the right file per region and EXEC msdb.dbo.sp_send_dbmail @profile_name = '', @recipients = @email, @body = '', @subject = ' @file_attachments =' that is is but i deleted information after the = signs
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.