SmtpClient has following methods for sending mails.
- Send(MailMessage)
- Send(string, string, string, string)
- SendAsync(MailMessage, Object) (Here, "object" can be any reference which allows the callback to identify the send operation.)
- SendAsync(string, string, string, string, Object) (Here, "object" can be any reference which allows the callback to identify the send operation.)
For these methods, we need to provide the MailMessage(Sl. No. 1 and 3) with all the details like From, To, Subject, Body etc.(Sl. No. 2 and 4) or we can provide it in the parameters directly.
To send mails using normal TCP/IP without SSL connection the server does not need to have any certificates. Due to this, EnableSsl property can be false for SmtpClient class.
If the emails needs to be sent over SSL/TLS connection, you don't need to install certificates on your machine. The data is encrypted by server certificate public/private key pair.
AlternateViews can be used to display mail in different formats e.g. if we are displaying HTML in our email and the user does not have an HTML reader then we should provide some data in plain-text also so that the user can get some information from the page.
SmtpClient does not have a Finalize method. We need to call the Dispose method to exlicitly free up the resources.
AlternateViews can be used to display mail in different formats e.g. if we are displaying HTML in our email and the user does not have an HTML reader then we should provide some data in plain-text also so that the user can get some information from the page.
SmtpClient does not have a Finalize method. We need to call the Dispose method to exlicitly free up the resources.
No comments:
Post a Comment