MailItem.Send Event (Outlook)

Occurs when the user selects the Send action for an item, or when the Send method is called for the item, which is an instance of the parent object.


expression. Send( _Cancel_ )

expression A variable that represents a MailItem object.


Name Required/Optional Data type Description
Cancel Required Boolean (Not used in VBScript). False when the event occurs. If the event procedure sets this argument to True , the send operation is not completed and the inspector is left open.


In Microsoft Visual Basic Scripting Edition (VBScript), if you set the return value of this function to False , the item is not sent.


This Visual Basic for Applications (VBA) example uses the Send event and sends an item with an automatic expiration date. The sample code must be placed in a class module such as ThisOutlookSession, and the SendMyMail procedure must be called before the event procedure can be called by Microsoft Outlook.

Public WithEvents myItem As Outlook.MailItem 
Sub SendMyMail() 
 Set myItem = Outlook.CreateItem(olMailItem) 
 myItem.To = "Dan Wilson" 
 myItem.Subject = "Data files information" 
End Sub 
Private Sub myItem_Send(Cancel As Boolean) 
 myItem.ExpiryTime = #2/2/2003 4:00:00 PM# 
End Sub

See also

MailItem Object