Implementation of the mail sending Function

Source: Internet
Author: User

 

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">
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.