• Creator
    Topic
  • #4165
    jherkrath
    Participant

      Hi,

      we are an possible new customer.

      How we can limit the number of addressees that are chosen in the To, CC & BCC fields?

      We find a posting from MPLB with the same question, but we don’t understand the explanation.

      Can you send us a little script for example?

      Regards
      Achim

      [This message was edited by jherkrath on October 11, 2005 at 02:44 AM.]

    • Author
      Replies
    • #7325
      Support 1a
      Participant

        Thank you for your question. We’ll see if we can come up with some example code and post it here shortly.

        Regards,

        Advansys Support

        #7322
        Support 1a
        Participant

          Here’s some sample code that checks the ‘To’ field to ensure it doesn’t contain more than 3 recipients. (The number can be changed by changing the value of the constant). The applet would need to be integrated with the OnSend event.

          Please note this technique doesn’t check to see if any of the recipients are in groups. This requires a more complex solution.

          I hope this helps.

          Advansys Support

          ' This sample code will check the number of addresses in the TO field and stop
          ' sending the message if the addresses exceed the limit.  The applet must be
          ' integrated to fire in response to the OnSend event.
          
          const IDS_EXCEED_LIMIT = 3
          
          
          '-------------------------------------------------------------------------------
          ' Main line processing
          '-------------------------------------------------------------------------------
          sub Main(Client, GWEvent)
          
            ' Stop the send if the number of recipients exceeds IDS_EXCEED_LIMIT.
            if (GetTotalAddresses(groupwise.ItemGetText("X00", itfTo)) > IDS_EXCEED_LIMIT) then
              call msgbox("", vbExclamation, "Advansys Formativ")
              groupwise.CancelGroupWiseEvent = true
            end if
          
          End Sub
          
          
          '-------------------------------------------------------------------------------
          ' Get total number of addresses in the field.
          '-------------------------------------------------------------------------------
          function GetTotalAddresses(addresses)
          
            if (len(addresses) = 0) then
              GetTotalAddresses = 0
              exit function
            end if
          
            if (instr(1, addresses, ";", vbTextCompare) > 0) then
               GetTotalAddresses = ubound(Split(addresses, ";", -1, vbTextCompare)) + 1
            elseif (instr(1, addresses, ",", vbTextCompare) > 0) then
               GetTotalAddresses = ubound(Split(addresses, ",", -1, vbTextCompare)) + 1
            else
               GetTotalAddresses = 1
            end if
          
          end function
          #7323
          jherkrath
          Participant

            Thanks for your quick help.
            Your script works very fine.

            Greetings
            Achim

            #7324
            Support 2
            Moderator

              Great news and thanks for your feedback.

              Regards,

              Advansys Support

            Viewing 4 replies - 1 through 4 (of 4 total)
            • You must be logged in to reply to this topic.