Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1294
  • Last Modified:

Creating Multiple lines using msdb..sp_send_dbmail

This is a sample of my e-mail creattion. However, I have to add more information which I would like to have presented on another line so it looks nice and in a readable format when the email is sent.  How do I format and e-mail with multiple lines and format it to position cetain data on certain lines?  The bodyStr is just a varcahr of 4000 bytes so it will just wrap and not look presentable???

set @monthEnding = CONVERT(varchar,@ToDate,101)
Set @bodyStr = 'MOSS identified closed issues totaling $' + @eGRNDAmountTotal + ' for month ending ' + @monthEnding

exec msdb..sp_send_dbmail
      --      @profile_name = 'Mail Test',
            @profile_name = 'DBMAIL',
               @recipients = 'dm3295@att.com',
            @body = @bodyStr,
            @Subject = 'Report:  MOSS Executive Monthly Report.'
My e-mail format I would like to have is as follows

Our Group identified and closed issues totaling $________ for the month of___________

·        Regional Billing total invoices affected _________________  totaling to  $__________
·        ATT Render Billing total invoices affected_______________  totaling to $___________


1 Solution
if you are sending plain text try adding char(10)+chr(13) for new lines (or only chr(10) for some encodings)

if you sending html data, then insert <BR>

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now