Sends the specified e-mail message to an SMTP server for delivery. The message sender, recipients, subject, and message body are specified using string objects.
This method blocks while the e-mail is transmitted. You can specify a time-out value using the SmtpClient.Timeout property to ensure that the method returns after a specified amount of time elapses.
Before calling this method, the SmtpClient.Host and SmtpClient.Port properties must be set either through the configuration files by setting the relevant properties, or by passing this information into the SmtpClient.#ctor(string, int) constructor.
You cannot call this method if there is a message being sent asynchronously.
If the SMTP host requires credentials, you must set them before calling this method. To specify credentials, use the SmtpClient.UseDefaultCredentials or SmtpClient.Credentials properties.
If you receive an System.Net.Mail.SmtpException exception, check the SmtpException.StatusCode property to find the reason the operation failed. The System.Net.Mail.SmtpException can also contain an inner exception that indicates the reason the operation failed.
When sending e-mail using erload:System.Net.Mail.SmtpClient.Send to multiple recipients and the SMTP server accepts some recipients as valid and rejects others, erload:System.Net.Mail.SmtpClient.Send sends e-mail to the accepted recipients and then a System.Net.Mail.SmtpFailedRecipientsException is thrown. The exception will contain a listing of the recipients that were rejected.
If the SmtpClient.EnableSsl property is set to true, and the SMTP mail server does not advertise STARTTLS in the response to the EHLO command, then a call to the erload:System.Net.Mail.SmtpClient.Send or erload:System.Net.Mail.SmtpClient.SendAsync methods will throw an System.Net.Mail.SmtpException.