Dbmail HTML body size limit

  • My error.....please disregard.

    When sending an email in HTML format, shouldn't this allow for 2gb of data? Mine is getting truncated after 4000 characters.

    @body NVARCHAR(MAX) = NULL,

    EXEC msdb.dbo.sp_send_dbmail

    @recipients='someone@some.com',

    @reply_to='someone'

    @from_address='someone@here.com>',

    @profile_name = 'profilename',

    @body_format = 'HTML',

    @body = 'lots of data'

  • body is defined as nvarchar(max), so it's likely that you are getting some implicit conversions to nvarchar(4000) when you are building your htmlbody.

    can you show the code that builds that?

    that's most likely where the issue is; i know for a fact i send regular emails with htmlized bodies that far exceed 12K in characters.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • TryingToLearn (11/4/2015)


    When sending an email in HTML format, shouldn't this allow for 2gb of data? Mine is getting truncated after 4000 characters.

    @body NVARCHAR(MAX) = NULL,

    EXEC msdb.dbo.sp_send_dbmail

    @recipients='someone@some.com',

    @reply_to='someone'

    @from_address='someone@here.com>',

    @profile_name = 'profilename',

    @body_format = 'HTML',

    @body = 'lots of data'

    Where are you viewing this to know it is getting truncated? If you are viewing the values in SSMS that is because SSMS will truncate long strings.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

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

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