/ Forums / Advansys Formativ / Creating Solutions with Formativ / How to determine recipient address?

  • Creator
    Topic
  • #4144
    GoumJer
    Participant

      Hi,

      How can I determine the recipient adres from an email msg? I want to take action on incoming emails depending on the recipient adres, which most times is a mailing-list.

      I can determine subject (msg.subject) and sender (msg.sender) but no way found yet for the recipient.

      Thanks for the help!

      Regards,

      Jeroen

    • Author
      Replies
    • #7260
      Support 1a
      Participant

        The following code displays the email addresses for the current message.

        dim oMsg
          dim oRecipient
         
          set oMsg = client.clientstate.commandmessage
         
          if oMsg is nothing then
            exit sub
          end if
         
          for each oRecipient in oMsg.recipients
            msgbox oRecipient.displayname & vbcrlf & oRecipient.emailaddress
          next
         
          set oRecipient = nothing
          set oMsg = nothing
        

        You can apply this technique to any instance of a message object.

        I hope this helps.

        Advansys Support

        #7263
        GoumJer
        Participant

          Thanks for your help, this works fine.

          However,

          my sorting routine is triggerd on Message Arrival event.

          This works fine for a single message. But when I receive more e-mails while the first one is processed, the others won’t be processed anymore. Only the first mail which arrives _after_ the mail gets handled.

          How can I be sure that all new mail is taken care of?

          Thanks,

          Jeroen

          #7259
          Support 1a
          Participant

            You need to modify your applet to locate all new messages, then process them in tern in response to a new message event. I would also suggest you integrate with the OnStartup event as well in order to process messages that may have arrived while the client was not running.

            See the GetQuickMessagesCollection() and FindMessages() methods of the Folder object as a start. These are both native Object API methods you’ll find documented on the Novell web site – http://developer.novell.com/ndk/doc/gwobjapi/index.html?page=/ndk/doc/gwobjapi/gwobjenu/data/h7ikbsqg.html

            Regards,

            Advansys Support

            #7264
            Support 1a
            Participant

              Here’s one approach:

              dim oMsg
                dim oMessages
               
                iFilter = "(MAIL) AND (BOX_TYPE = INCOMING) AND (NOT READ)"
                Set oMessages = GroupWise.Account.MailBox.FindMessages(iFilter)
               
                if oMessages is nothing then
                  exit sub
                end if
               
                for each oMsg in oMessages
                  msgbox oMsg.subject
                next
               
                set oMsg = nothing
                set oMessages = nothing
              

              Advansys Support

              #7262
              GoumJer
              Participant

                Hello,

                thank’s for the suggestion, works fine!

                I now have just to speed things up, but the techniques are working.

                Regards,

                Jeroen

                #7261
                Support 1a
                Participant

                  Good news!

                  Advansys Support

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