ASP. net mvc 5 Series (7) mail server and client, asp. netmvc

Source: Internet
Author: User
Tags imap all mail in domain

ASP. net mvc 5 Series (7) mail server and client, asp. netmvc


I. Overview

Ii. MX settings

3. Use the SMTP function of the system to send emails

4. Use hMailServer to send and receive emails

V. Web Mail Client

I. Overview

First, we must know that SMTP is the core of the mail server. It is up to SMTP to send and receive mails. If you disable POP3 and imap of the hMailServer, the server can still send and receive emails. POP3 and IMAP are only two protocols implemented by the mail server to provide the mail client for receiving and managing mail. The POP3 protocol can only receive mail from the server, the IMAP protocol allows the client to manage mails on the server. Currently, almost all third-party servers have limits on sending quotas, and almost all mail servers check whether the sender's domain name and IP address match. Simply put, we should not use third-party tests or self-built locahost e-mail tests. How can we test this? There are three solutions for sending tests in a non-server environment:

(1) Send a simulated email. Write emails to log files.

(2) receive a simulated email. Use SMTP of localhost to send emails. Use SMTP4DEV to intercept and receive emails. Use windows live mail, Windows MBox Viewer, and other clients that can read the eml format to obtain emails in the correct format. The recipient will not receive the emails.

(3) If the domain name and server are available, set up the domain name MX and the mail server, and send the actual mail through SMTP of the mail server. You can check the IP address of the recipient's server, but you must configure security measures to prevent the email server from being used.

Sending emails can use the SMTP function of Windows Server 2008 +, but does not provide system support for POP3 and IMAP protocols. Therefore, you cannot use a client to access the mail Server.

If we want to use a client to access the mail Server, hMailServer is the best choice for free and Windows Server 2008 + environments. If you want to switch to hMailServer, remember to disable the system's SMTP service. Otherwise, the hMailServer cannot listen to the SMTP port and cannot receive emails.

Ii. MX settings

MX settings are configured in domain name resolution as follows:

Check MX settings on the service:

3. Use the SMTP function of the system to send Emails:

Taking Windows Server 2008 as an example, the SMTP function installation and service settings are relatively simple, which is omitted here.

1. Domain Name Configuration:

First, set the domain name in transfer-> advanced

2. IP configuration

3. Send an email via. NET:
Web. config Configuration:

Sending code:

4. Use hMailServer to send and receive emails: Install and compile hMailServer. Remember that you must use both SMTP and POP3 to use hMailServer, and stop the built-in SMTP service. Otherwise, you cannot receive emails. 1. Add Domain Name:
2. Add an account:
3. Configure email submission:
4. bind an IP Address:
5. configure the IP address range: in the figure, Auto-ban is used because my password is too simple and fails during the test. As a result, hMailServer automatically blocks the IP address of the server. Therefore, you need to configure this restriction. This step is not required in other cases. 6. Test the Configuration:
5. The Web mail client can use Outlook Express and FoxMail in CS mode to send and receive mails, or use the receiving proxy function provided by BS mode such as 163 to receive mails. HMailserver provides the sending and receiving functions of the mail server, and supports POP3 and IMAP protocols at the same time. Open-source free Web mail client, non-. NET Web mail client implementation, commonly used such as PHP SquirrelMail and RoundCube .. NET, but the library of the collection protocol component is still indispensable. Sometimes you need to integrate the mail management function in the background, you can directly use these components, such as imretrial. 1. Integrated Mail list function: 2. Mark Read unread:
3. delete an email:
4. Interface reference:
Sending emails and replying emails involves a relatively complex process such as address book, draft, and attachment. check whether it is necessary to integrate complete functions. After all, the component library has provided complete functions, we only need to package and call them, and work with interface operations. The difficulty of building a complete Ajax-supported Web client interface is not implemented in the background, but at the front end, it has little to do with the topic. If you are interested, you can implement it by yourself.

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: 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.