Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.8 KiB

  1. Sample: ReplyAll
  2. Purpose:
  3. This application demonstrates how to use the MSMQ Mail COM object library from VB.
  4. The application waits for a MSMQ mail message to be received on a given queue. When
  5. one arrives, it is prompted on the form, and a reply message is sent to all its recipients,
  6. excluding the queue itself.
  7. Requirements:
  8. MSMQ must be installed.
  9. Overview:
  10. When a ReplyAll application is started, the user has to specify a queue label and then
  11. click the Start button. The application then searches for a queue of type MSMQ mail
  12. service, with this label. If one is found, it is opened for receive access. Otherwise, the user
  13. is asked whether to create that queue. If the user chooses �yes�, the queue is created and
  14. opened for receive access. A timer is set, and every 50 msec the receive queue is checked
  15. for incoming mail messages. All messages in the queue are received in a loop.
  16. Incoming message handling:
  17. 1. The message is parsed and displayed on the form. If it is a text message, the text is
  18. displayed as the content of the form. If the message is a form, all form field names
  19. are displayed, each followed by the field data.
  20. 2. A reply message is prepared. �RE:� is added to the subject if not already there. The
  21. receiving queue label is set as the sender address, and the mail message is sent back
  22. to the sender, as well as to all of the message's recipients, excluding the sender of the reply
  23. message. The reply message is of the same type as the received message. A reply field or string
  24. is added to it accordingly.
  25. Clicking the Stop button then stops the application from receiving messages from the queue, and the queue is closed.
  26. Comments:
  27. MSMQ Mail is not supported on computers without access to a directory service (DS disabled). In such case,
  28. the application will exit with an appropriate popup message.