Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Does @recipients have a length limit ?

Author  Topic 

rmuscarello
Starting Member

7 Posts

Posted - 2002-06-04 : 12:29:02
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?

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-06-04 : 13:13:00
you might have to send multiple emails.

setBasedIsTheTruepath
<O>

Edited by - setbasedisthetruepath on 06/04/2002 13:13:41
Go to Top of Page

Onamuji
Aged Yak Warrior

504 Posts

Posted - 2002-06-04 : 13:13:45
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...

Go to Top of Page

rmuscarello
Starting Member

7 Posts

Posted - 2002-06-04 : 13:17:38
Would you have an example I could look at?
Go to Top of Page

Onamuji
Aged Yak Warrior

504 Posts

Posted - 2002-06-04 : 15:38:14
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...

Go to Top of Page
   

- Advertisement -