Avoid Character Limit in Send Mail Task BCC Field

  • Hello:

    I have a Send Mail Task that pulls a semicolon-separated email list string into a variable, then uses the variable in the BCC field of the email. This package ran fine until recently, when I received this message:

    Your message did not reach some or all of the intended recipients.

    Subject: My Email Subject

    Sent:10/1/2010 1:30 AM

    The following recipient(s) could not be reached:

    sampleperson.yah on 10/3/2010 1:39 AM

    Could not deliver the message in the time limit specified. Please retry or contact your administrator.

    If you look at the email address where it failed, you'll notice that the domain is cut off. The email address is fine in the database, so I'm assuming the entire email string is getting cut off at a certain point due to a character limit in the BCC line.

    My package is set up like this: I have an Execute SQL Task with a Single Row ResultSet; the SQL statement calls a stored procedure that forms the semicolon-delimited email string. The results are placed into an nvarchar string variable called User::vList. Then I have a Send Mail Task where the BCCLine expression is @[User::vList].

    I've been researching character limits in Send Mail Tasks, but I can't find anything that will help me get around this. Can anyone help?

  • The first thing I would check is if the string is being cut as it comes out of the database table. Is it possible you're using a SQL variable that is too short?



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Hi, Alvin:

    Thanks for the quick response! I ran the stored procedure in Management Studio, and it's not getting cut off there. In the stored procedure, the email list parameter is declared as nvarchar(4000). When I map the parameter to the variable in the Execute SQL Task, the parameter length is also 4000.

  • There's a 256 character limit on the email address fields.

    http://technet.microsoft.com/en-us/library/ms142165(SQL.90).aspx



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • That's what I thought. I just need a way to get around that; this email has the potential to have to go out to over 100 people, so 256 characters just isn't going to cut it. To be honest, I'm a little confused at why that limit exists; my email address alone has 29 characters in it. Are we really limited to sending to so few recipients at a time?

  • lk-681111 (10/5/2010)


    That's what I thought. I just need a way to get around that; this email has the potential to have to go out to over 100 people, so 256 characters just isn't going to cut it. To be honest, I'm a little confused at why that limit exists; my email address alone has 29 characters in it. Are we really limited to sending to so few recipients at a time?

    As it said in the link I provided, that is done to comply with international email standards, so, yes, you are limited. Looks like you may have to send multiple emails instead.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Ugh. Oh, well, it was worth a try. I ended up just using a ForEach Loop to send a separate email to each individual recipient. I was hoping for a more elegant solution, but at least it's done! Thanks for your help. 🙂

Viewing 7 posts - 1 through 6 (of 6 total)

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