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.
The optional Sender argument identifies the sender of the
message and must be a standard Internet e-mail address. If this
argument is omitted, then the address specified by the From
property will be used.
The optional Recipient argument 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 used to determine the recipients of the
message.
The optional Message argument specifies a complete e-mail
message that will be delivered. This must be a properly formatted
message that conforms to the standards for Internet e-mail. If this
argument is omitted, then the current message is sent. If this
argument 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.
The Options argument specifies one or more options for
sending the message. If this argument is omitted, the value of the
Options property will be used instead.
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.
This method will return a value of zero if the action was
successful. Otherwise, a non-zero error code is returned which
indicates the cause of the failure.