Sometimes we need to add the email sending function to the website. For example, an online contribution system sends an email to the author when the manuscript is used. The following uses this function as an example to describe how to automatically send emails.
Mail sending FunctionFirst, let's talk about how to send an email in. Net .. Net has prepared classes related to sending emails for us. It is very convenient to call them directly. The following is an email notification class I wrote: /// <summary> /// email notification service class. /// </Summary> public class EmailNotificationService {/// <summary> /// create an instance of the mail Notification Service class. /// </Summary> /// <param name = "smtpService"> SMTP Server IP address </param> /// <param name = "enableSSL"> whether to use SSL connect to the SMTP server </param> /// <param name = "port"> SMTP server port </param> /// <param name = "loginName"> used to log on to SMTP server Username </param> /// <param name = "password"> logon password </param> public EmailNotificationService (string smtpService, bool enableSSL, int port, string loginName, string password) {this. m_smtpService = smtpService; thi S. m_loginName = loginName; this. m_password = password; this. m_enableSSL = enableSSL; this. m_port = port;} private readonly string m_smtpService; private readonly string m_loginName; private readonly string m_password; private readonly bool m_enableSSL; private readonly int m_port; /// <summary> /// send an EMAIL notification to the specified EMAIL address. /// </Summary> /// <param name = "senderName">