| Catalyst Internet Mail .NET |
|
InternetMail.SendMessage Method (String,
Int32, String, String, String, String, String, Int32,
InternetMailOptions)
Submit the specified message to a mail server for delivery.
Parameters
- hostName
- A string value which specifies the host name or IP address of
the mail server that the message will be submitted to for
delivery.
- hostPort
- An integer value which specifies the port number which should
be used to establish a connection with the mail server. The default
port number is 25 for the Simple Mail Transfer Protocol.
- userName
- A string value which specifies the user name that will be used
to authenticate the client session with the mail server.
- userPassword
- A string value which specifies the password that will be used
to authenticate the client session with the mail server.
- senderAddress
- A string argument which specifies the e-mail address of the
person sending the message. This typically corresponds to the
address in the From header of the message, but it is not required
that they be the same.
- recipientAddress
- A string argument which specifies the e-mail address of the
person or persons to receive the message. Multiple addresses may be
specified by separating each address with a comma. It should be
noted that this protocol is only concerned with the delivery of a
message and not its contents. Header fields in the message are not
parsed to automatically determine the recipients. This argument
should be a concatenation of all recipients, including carbon
copies and blind carbon copies, with each address separated with a
comma.
- messageText
- A string that contains the message to be delivered to the
specified recipients. The message must be text and conform to the
basic structure defined in RFC 822. There must be one or more
headers separated by a blank line, followed by the body of the
message. Each line of text must be terminated by a carriage return
and linefeed character sequence.
- timeout
- An integer value which specifies a timeout period in seconds.
If the message cannot be submitted within the specified time
period, the method will fail. The default timeout value for
connections is 20 seconds.
- options
- An InternetMailOptions
enumeration which specifies the options that can be used when
delivering the message.
Return Value
This method returns a boolean value. If the method succeeds, the
return value is true. If the method fails, the
return value is false. To get extended error
information, check the value of the LastError property.
Remarks
The SendMessage method enables an application to send a
formatted e-mail message using the current mail server. This
provides a convenient one-step method of addressing and sending a
message.
This method will cause the current thread to block until the
message transfer completes, a timeout occurs or the transfer is
canceled. During the transfer, the OnProgress event will
fire periodically, enabling the application to update any user
interface objects such as a progress bar.
The mail server that is specified must be configured to permit
relaying messages, or the submission may fail. In most cases, the
server will require that the client authenticate the session with a
username and password. Alternatively, some mail servers require
that you connect and authenticate with their POP3 service before
the SMTP service will accept a message. Consult the documentation
for your mail service provider for more information on the
requirements for submitting messages for delivery.
See Also
InternetMail Class |
SocketTools Namespace | InternetMail.SendMessage
Overload List