Platforms to show: All Mac Windows Linux Cross-Platform

Back to MapiMessageMBS class.

MapiMessageMBS.AddFile(file as MapiFileMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Windows MBS Win Plugin 8.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Adds a file to the message file list.

file must be not nil.

MapiMessageMBS.AddRecipient(recipient as MapiRecipientMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Windows MBS Win Plugin 8.3 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Adds a recipient to the message.

recipient must be nil.

Some examples using this method:

MapiMessageMBS.SendMail(parent as DesktopWindow, SendFlags as Integer, Threaded as Boolean) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Windows MBS Win Plugin 22.0 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sends an email.

Parameters:

parent:
The parent window for the dialogs used. If not nil the dialogs used will be modal.

SendFlags: Send flags. Default in older plugin versions was kSendFlagDialog when DisplayDialog parameter is true and kSendFlagLogonDialog if DisplayLogonDialog parameter was true.

Error codes:

const SUCCESS_SUCCESS = 0No error.
const MAPI_USER_ABORT = 1The user canceled one of the dialog boxes. No message was sent.
const MAPI_E_FAILURE = 2One or more unspecified errors occurred. No message was sent.
const MAPI_E_LOGON_FAILURE = 3There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed. No message was sent.
const MAPI_E_DISK_FULL = 4
const MAPI_E_INSUFFICIENT_MEMORY = 5There was insufficient memory to proceed. No message was sent.
const MAPI_E_ACCESS_DENIED = 6
const MAPI_E_TOO_MANY_SESSIONS = 8
const MAPI_E_TOO_MANY_FILES = 9There were too many file attachments. No message was sent.
const MAPI_E_TOO_MANY_RECIPIENTS = 10There were too many recipients. No message was sent.
const MAPI_E_ATTACHMENT_NOT_FOUND = 11The specified attachment was not found. No message was sent.
const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12The specified attachment could not be opened. No message was sent.
const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
const MAPI_E_UNKNOWN_RECIPIENT = 14
const MAPI_E_BAD_RECIPTYPE = 15The type of a recipient was not TypeTO, TypeCC, or TypeBCC. No message was sent.
const MAPI_E_NO_MESSAGES = 16
const MAPI_E_INVALID_MESSAGE = 17
const MAPI_E_TEXT_TOO_LARGE = 18The text in the message was too large. No message was sent.
const MAPI_E_INVALID_SESSION = 19
const MAPI_E_TYPE_NOT_SUPPORTED = 20
const MAPI_E_AMBIGUOUS_RECIPIENT = 21A recipient matched more than one of the recipient descriptor structures and Dialog is false. No message was sent.
const MAPI_E_MESSAGE_IN_USE = 22
const MAPI_E_NETWORK_FAILURE = 23
const MAPI_E_INVALID_EDITFIELDS = 24
const MAPI_E_INVALID_RECIPS = 25One or more recipients were invalid or did not resolve to any address.
const MAPI_E_NOT_SUPPORTED = 26

The MAPI SendMail function sends a standard message, with or without any user interaction. The profile must be configured so that MAPISendMail can open the default service providers without requiring user interaction.

Client applications can provide a full or partial list of recipient names, subject text, file attachments, or message text. If any information is missing, MAPISendMail can prompt the user for it. If no information is missing, either the message can be sent as is or the user can be prompted to verify the information, changing values if necessary.

A successful return from MAPISendMail does not necessarily imply recipient validation. The message might not have been sent to all recipients. Depending on the transport provider, recipient validation can be a lengthy process.

A "" value for the Subject indicates that there is no text for the subject of the message. A "" value for the NoteText member indicates that there is no message text. Some client applications can truncate subject lines that are too long or contain carriage returns, line feeds, or form feeds.

Each paragraph should be terminated with a CR (0x0d), an LF (0x0a), or a CRLF pair (0x0d0a). MAPISendMail wraps lines as appropriate. If the text exceeds system limits, the function returns the MAPI_E_TEXT_TOO_LARGE value.

The MessageType property is used only by non-IPM applications. Applications that handle IPM messages can set it to "".

The number of attachments per message can be limited in some messaging systems. If the limit is exceeded, the MAPI_E_TOO_MANY_FILES value is returned. File attachments are copied to the message before MAPISendMail returns; therefore, later changes to the files do not affect the contents of the message. The files must be closed when they are copied. Do not attempt to display attachments outside the range of the message text.

Some messaging systems can limit the number of recipients per message. If the client application passes a non-nil value indicating a number of recipients exceeding the system limit, MAPISendMail returns the MAPI_E_TOO_MANY_RECIPIENTS value. If the recipient array is empty, the Dialog parameter must be true in the call to MAPISendMail.

Note that the recipients can include either an entry identifier, the recipient's name, an address, or a name and address pair. The following table shows how MAPISendMail handles the variety of information that can be specified:

Information Action
entry identifierNo name resolution; the name and address are ignored.
nameName resolved using the Simple MAPI resolution rules.
addressNo name resolution; address is used for both message delivery and for displaying the recipient name.
name and addressNo name resolution; name used only for displaying the recipient name.

Client applications that send messages to custom recipients can avoid name resolution. Such clients should set the Address member of the recipient to the custom address.

MAPISendMail does not require an originator-type recipient to send a message.

Important Simple MAPI is not installed by Exchange Server 2003 or later. However, Simple MAPI is supported for use with Exchange 2003. To function properly, the underlying Exchange or Microsoft Outlook® MAPI subsystem must be properly installed on the client computer.

See also:

Some examples using this method:

MapiMessageMBS.SendMail(parent as window, SendFlags as Integer, Threaded as Boolean) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Windows MBS Win Plugin 18.5 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sends an email.

Parameters:

parent:
The parent window for the dialogs used. If not nil the dialogs used will be modal.

SendFlags: Send flags. Default in older plugin versions was kSendFlagDialog when DisplayDialog parameter is true and kSendFlagLogonDialog if DisplayLogonDialog parameter was true.

Error codes:

const SUCCESS_SUCCESS = 0No error.
const MAPI_USER_ABORT = 1The user canceled one of the dialog boxes. No message was sent.
const MAPI_E_FAILURE = 2One or more unspecified errors occurred. No message was sent.
const MAPI_E_LOGON_FAILURE = 3There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed. No message was sent.
const MAPI_E_DISK_FULL = 4
const MAPI_E_INSUFFICIENT_MEMORY = 5There was insufficient memory to proceed. No message was sent.
const MAPI_E_ACCESS_DENIED = 6
const MAPI_E_TOO_MANY_SESSIONS = 8
const MAPI_E_TOO_MANY_FILES = 9There were too many file attachments. No message was sent.
const MAPI_E_TOO_MANY_RECIPIENTS = 10There were too many recipients. No message was sent.
const MAPI_E_ATTACHMENT_NOT_FOUND = 11The specified attachment was not found. No message was sent.
const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12The specified attachment could not be opened. No message was sent.
const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
const MAPI_E_UNKNOWN_RECIPIENT = 14
const MAPI_E_BAD_RECIPTYPE = 15The type of a recipient was not TypeTO, TypeCC, or TypeBCC. No message was sent.
const MAPI_E_NO_MESSAGES = 16
const MAPI_E_INVALID_MESSAGE = 17
const MAPI_E_TEXT_TOO_LARGE = 18The text in the message was too large. No message was sent.
const MAPI_E_INVALID_SESSION = 19
const MAPI_E_TYPE_NOT_SUPPORTED = 20
const MAPI_E_AMBIGUOUS_RECIPIENT = 21A recipient matched more than one of the recipient descriptor structures and Dialog is false. No message was sent.
const MAPI_E_MESSAGE_IN_USE = 22
const MAPI_E_NETWORK_FAILURE = 23
const MAPI_E_INVALID_EDITFIELDS = 24
const MAPI_E_INVALID_RECIPS = 25One or more recipients were invalid or did not resolve to any address.
const MAPI_E_NOT_SUPPORTED = 26

The MAPI SendMail function sends a standard message, with or without any user interaction. The profile must be configured so that MAPISendMail can open the default service providers without requiring user interaction.

Client applications can provide a full or partial list of recipient names, subject text, file attachments, or message text. If any information is missing, MAPISendMail can prompt the user for it. If no information is missing, either the message can be sent as is or the user can be prompted to verify the information, changing values if necessary.

A successful return from MAPISendMail does not necessarily imply recipient validation. The message might not have been sent to all recipients. Depending on the transport provider, recipient validation can be a lengthy process.

A "" value for the Subject indicates that there is no text for the subject of the message. A "" value for the NoteText member indicates that there is no message text. Some client applications can truncate subject lines that are too long or contain carriage returns, line feeds, or form feeds.

Each paragraph should be terminated with a CR (0x0d), an LF (0x0a), or a CRLF pair (0x0d0a). MAPISendMail wraps lines as appropriate. If the text exceeds system limits, the function returns the MAPI_E_TEXT_TOO_LARGE value.

The MessageType property is used only by non-IPM applications. Applications that handle IPM messages can set it to "".

The number of attachments per message can be limited in some messaging systems. If the limit is exceeded, the MAPI_E_TOO_MANY_FILES value is returned. File attachments are copied to the message before MAPISendMail returns; therefore, later changes to the files do not affect the contents of the message. The files must be closed when they are copied. Do not attempt to display attachments outside the range of the message text.

Some messaging systems can limit the number of recipients per message. If the client application passes a non-nil value indicating a number of recipients exceeding the system limit, MAPISendMail returns the MAPI_E_TOO_MANY_RECIPIENTS value. If the recipient array is empty, the Dialog parameter must be true in the call to MAPISendMail.

Note that the recipients can include either an entry identifier, the recipient's name, an address, or a name and address pair. The following table shows how MAPISendMail handles the variety of information that can be specified:

Information Action
entry identifierNo name resolution; the name and address are ignored.
nameName resolved using the Simple MAPI resolution rules.
addressNo name resolution; address is used for both message delivery and for displaying the recipient name.
name and addressNo name resolution; name used only for displaying the recipient name.

Client applications that send messages to custom recipients can avoid name resolution. Such clients should set the Address member of the recipient to the custom address.

MAPISendMail does not require an originator-type recipient to send a message.

Important Simple MAPI is not installed by Exchange Server 2003 or later. However, Simple MAPI is supported for use with Exchange 2003. To function properly, the underlying Exchange or Microsoft Outlook® MAPI subsystem must be properly installed on the client computer.

See also:

MapiMessageMBS.SendMail(SendFlags as Integer, Threaded as Boolean) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Windows MBS Win Plugin 18.5 ❌ No ✅ Yes ❌ No ❌ No Desktop, Console & Web
Sends an email.

This method is without parent window for dialogs, so you can use it in a console project.

See also:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...