|
Send an email message to one or more recipients.
Syntax
object.SendMessage( [Sender],
[Recipient], [Message], [Options] )
Parameters
- Sender
- An optional string value that identifies the sender of the
message and must be a standard Internet email address. If this
argument is omitted, then the address specified by the From
property will be used.
- Recipient
- An optional string value that specifies one or more recipients
of the message. If this argument is omitted, then the addresses
listed in the Bcc, Cc and To
properties will be combined to determine the recipients of the message.
- Message
- An optional string value that contains a complete email
message. This must be a properly formatted message that conforms to
the standards for Internet email. If this argument is omitted, then
the current message is sent.
- Options
- An optional integer value that specifies one or more options for
sending the message. If this argument is omitted, the value of the
Options property will be used instead. One or more of the
following values may be used:
Value |
Description |
mailOptionImplicitSSL |
This option specifies that an implicit TLS session should be
established with the mail server and prevents the use of a
command which is used to negotiate an explicit TLS connection. |
mailOptionAuthLogin |
Specifies that the user must be authenticated to the mail
server before the message is delivered. This option should only
be used if a relay server supports AUTH LOGIN and requires
authentication. |
&HF0000 |
mailOptionNotify |
Notify the sender of the delivery status of the message, if
the server supports delivery status notification. This option is
a combination of the mailNotifySuccess,
mailNotifyFailure, mailNotifyDelay and
mailReturnHeaders options. |
&H10000 |
mailNotifySuccess |
If the mail server supports delivery status notification,
this causes a message to be returned to the sender once it has
been successfully delivered. |
&H20000 |
mailNotifyFailure |
If the mail server supports delivery status notification,
this causes a message to be returned to the sender if it could
not be delivered. |
&H40000 |
mailNotifyDelay |
If the mail server supports delivery status notification,
this causes a message to be returned to the sender if delivery
has been delayed. |
&H80000 |
mailReturnHeaders |
If the mail server supports delivery status notification,
this causes a message to be returned which contains the headers
of the message that was sent. |
&H100000 |
mailReturnMessage |
If the mail server supports delivery status notification,
this causes a message to be returned which contains the complete
message that was sent. |
Return Value
A value of zero is returned if the method succeeds.
Otherwise, a non-zero error code is returned which indicates the
cause of the failure.
Remarks
The SendMessage method sends the specified message to one
or more recipients. This method can be used in a number of different
ways, depending on the arguments specified by the caller.
If the Message parameter is specified, but the sender and recipient
properties are omitted, then the message will be parsed and the
addresses will be automatically determined by the values of the From,
Cc and To header fields. Note that specifying a message
argument does not change the current message.
For each recipient listed, either as an argument to the method or
in the message itself, the SendMessage method will determine
the appropriate mail exchange server and deliver the message to that
user. If the RelayServer and RelayPort properties are
defined, then all messages will be relayed through that specific
server, regardless of the recipient address. Note that the
Secure property and related options only affects connections
to relay mail servers. See the RelayServer and
RelayPort properties for additional information.
If a relay server is being used, it may require authentication
before accepting any messages for delivery. To enable authentication,
specify the mailOptionAuthLogin option, either as an argument
or by setting the Options property. Prior to calling the
SendMessage method, the UserName and Password
properties should be set to the values that will be used to
authenticate the session. If the server does not support
authentication, or the user name or password is invalid, an error
will be returned. Note that authentication is only performed if a
relay server is used, otherwise the option is ignored.
See Also
Bcc Property,
Cc Property,
From Property,
RelayPort Property,
RelayServer Property,
Secure Property,
To Property
|
|