SSIS Send Mail task limited to 255 characters in address?

10,569

Strange, both Sql Server 2008 and 2005 state the following:

The To, Cc, and Bcc lines are limited to 256 characters each in accordance with Internet standards.

at the following address:
http://msdn.microsoft.com/en-us/library/ms142165.aspx

But I was able to use the following code to generate a ToLine like you were trying to do:

declare @toline varchar(8000)
set @toline = ' '

select @toline = @toline + EMAIL + ';' 
from Control.ControlPointMail where enabled = 1

select @toline = substring(@toline,1,len(@toline)-1)

select @toline  

The execute SQL task that runs this code puts it into a variable.
The variable is referenced in an expression for the to line of a send mail task.

I think that I would interpret the text from MSDN to be that the input field for the To, CC, and BCC lines are limited to 256 characters on the assumption that you would only be inputting one address at a time to that field.

Share:
10,569
MartW
Author by

MartW

Learning as I go...

Updated on June 04, 2022

Comments

  • MartW
    MartW almost 2 years

    Is this a bug, or some hidden limit I can't find any documentation about? When creating a Send Mail Task in SSIS 2008, the TO, CC and BCC fields seem to have a hidden limit of 255 characters. I'm aware this is the standard limit for individual email addresses, but all three are commonly used for multiple addresses and the comment for the To field even says "separate the recipients with semicolons". But nevertheless, it truncates the address to a maximum of 255 characters.

    Bug, non-obvious standard, or something I'm missing? Any way around this? We were trying to build a CC list dynamically, but this has caused a rethink.

    EDIT : After a little bit of Googling, I believe I've found the source of the standard referred to - it is RFC 2821 which says :

    domain
    The maximum total length of a domain name or number is 255 characters.

    path
    The maximum total length of a reverse-path or forward-path is 256 characters (including the punctuation and element separators).

  • MartW
    MartW about 14 years
    Another odd thing is that the IDE actually limits you to 255, not 256 as the link states.
  • Quicksilver
    Quicksilver almost 5 years
    @MartW Did you discover a way to force SSIS to take a longer to line? I can't tell from your code
  • William Salzman
    William Salzman over 4 years
    @Quicksilver the code was used to pass an arbitrary length (up to 8000 characters) into the toline of the send mail task. It used it with no issues. ONLY the UI for that task is limited to the 255 or 256 characters. The task behind the scenes properly uses what is sent via the expression to the toline field of the task.
  • Wolfgang Kais
    Wolfgang Kais about 4 years
    @WilliamSalzman Very nice, unfortunately the expression with a variable containing the long ToLine seems to be not working anymore.