Send Method (Message Object)

Send Method (Message Object)

The Send method sends the message to the recipients through the MAPI system.

Syntax

objMessage.Send( [saveCopy] [, showDialog**] [, parentWindow] )**

objMessage

Required. The Message object.

saveCopy

Optional. Boolean. If True, saves a copy of the message in a user folder, such as the Sent Items folder. The default value is True.

showDialog

Optional. Boolean. If True, displays a Send Message dialog box where the user can change the message contents or recipients. showDialog cannot be set to True when sending an AppointmentItem or MeetingItem object. The default value is False.

parentWindow

Optional. Long. The parent window handle for the Send Message dialog box. A value of zero (the default) specifies that the dialog box should be application-modal. The parentWindow parameter is ignored unless showDialog is True.

Remarks

Like the Update method, the Send method saves all changes to the message in the MAPI system, but Send also moves the message to the current users Outbox folder. Messaging systems retrieve messages from the Outbox and transport them to the recipients. After it is transported, a message is removed from the Outbox and deleted unless saveCopy is True.

You should compose your new messages in either your Inbox or your Outbox. The Send method normally deals only with messages located in these folders. However, if you have appointments in a calendar folder, you can send them from that folder.

If you are sending a meeting request from an AppointmentItem object, you must first set the appointment's MeetingStatus property to CdoMeeting, or the call to Send returns CdoE_NO_SUPPORT. Also, there is no form for showing a meeting request, so you must either set the showDialog parameter to False or let it default. If showDialog is True, Send returns CdoE_NO_SUPPORT.

While you are still composing a message you can set its Sent property to False or leave it unset. The Send method sets the Submitted property to True when the message is accepted in the message store. After the message is transported, the spooler function of the sending messaging system sets the Sent and Unread properties to True. The receiving messaging system sets the Submitted property to False.

The Send method invalidates the composed Message object but does not remove it from memory. The programmer should Set the invalidated object to Nothing to remove it from memory, or reassign it to another message. Attempted access to a sent message results in a return of CdoE_INVALID_OBJECT.

The Send dialog box is always modal, meaning the parent window is disabled while the dialog box is active. If the parentWindow parameter is set to zero or is not set, all windows belonging to the application are disabled while the dialog box is active. If the parentWindow parameter is supplied but is not valid, the call returns CdoE_INVALID_PARAMETER.

For more information on sending and posting messages, see Creating and Sending a Message and Posting Messages to a Public Folder.

The following methods can invoke dialog boxes:

However, if your application is running as a Microsoft® Windows NT® service, for example from Active Server Pages (ASP) script on a Microsoft® Internet Information Server (IIS), no user interface is allowed.

For more information on running as a service, see "Windows NT Service Client Applications" in the MAPI Programmer's Reference under Guide, Introduction to MAPI Programming, Operating Environment Issues.

See Also

Concepts

Message Object