Mail - inserting HTML file into body of message

  • Hello,

    we have freshly installed SQLS2005 on one of our servers and hit a problem with sending mail from stored procedures (regular checks of data etc.).

    With SQLS 2000 we were using xp_smtp_sendmail. Because the messages need to be read by people with various mail clients, the best solution was to send the result both in body of the message and as attachment. Procedures were using sp_makewebtask to create a HTML file with the result, and there was no problem to include this file into the body of the message using parameter @messagefile.

    In SQLS 2005, we use sp_send_dbmail, and using the same approach as before we have no problems to attach the file, but we can't incorporate the file into message body. When using parameter @body = @File, where @file is path+name of HTML file, the path and name is shown in the body - not the contents of the file, as it was in SMTP mail.

    Are we missing something, or is there really no way to incorporate existing file into message body in DBmail?

  • Same issue. Did you get it sorted?

  • Hi Greg,

    we did, but it was quite complicated and I think it required use of Visual Basic script to suit our needs (my colleague was working on it, not me). Fortunately, the integrated information system we are using offers now the possibility to send formatted e-mails from its workflow module, which is much better.

    With msdb..sp_send_dbmail, try whether this parameter will help you: @body_format = 'HTML'

    I don't understand VB much, I just know that we had our own stored procedure for sending mail, this procedure took HTML file (path+name) as parameter and then called VB script which somehow inserted contents of the file into message body.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply