Is there a limit to the length that @recipients can be? Because when I manually put in enough email address in the @recipients values to exceed 255 characters I get this error:
Server: Msg 17914, Level 18, State 1, Line 0 Unknown recipient: Parameter '@recipients', recipient ' rmuscarello@'
Which is a partial email address when the field gets to a length of 255. Is there a way around this?
the only way to get around this is to write an AppendRecipient() function or property that appends the value sent to it to the recipients value .... same for all fields this allows you to get around the 255 character limit imposed by the sp_OA* procedures...
if you create the vb DLL that interfaces with either MAPI or the CDONTS.NewMail object all you have to do is have:
Private m_strRecipients As String
Public Property Let Recipients(ByVal Value As String) m_strRecipients = m_strRecipients & Value End Property
... do that for each property you need to append data to .... you might want to do something like check len(Value) and see if it is zero and use that as a flag to clear the string or something .... figure it out not too complicated...
then you would just loop through your string
@Recipients VARCHAR(8000
SET @Recipients = .... your recipients ....
WHILE LEN(@Recipients) > 0 BEGIN sp_OASetProperty @objID, 'Recipients', LEFT(@Recipients, 200) SET @Recipients = RIGHT(@Recipients, LEN(@Recipients) - 200) END
.... something like that not too accurate on the syntax but you should be able to figure it out...