Add the ReplyTO function for Jmail.net and speed up sending multiple emails

Source: Internet
Author: User
Tags smtpclient

First of all, I declare that the content of this article and the technologies involved are only for study and technical research, and it does not involve any intentional infringement of the software copyright of the relevant company.

Since the long vacation, I have been pondering emails every day. However, I have carefully studied and understood the SMTP protocol and instructions over the past few days, and I have some knowledge about all aspects of email sending, in particular, the E-mail sending platform software compiled by myself had to learn deeply and improve its ability to do better.

During the compilation of the mail sending applet, I did several tests and found that the mail sending speed was very slow. On average, it would take 15 to 16 seconds to send an email. In this way, if I had 100 emails to send in a certain period of time, it would take more than half an hour to send text messages on a mobile phone. At first, I thought there was a problem with my code. I did not find any problems after careful check. In the tangle, I used Sina's smtp.sina.com server instead of the SMTP server, at this time, it was found that the email was sent at a speed of about 1 to 2 seconds. The problem was found on the company's email server.

The company's mail server uses Lotus Notes 8.0, a minicomputer, and around four thousand users. Theoretically, it should not be so slow. Contact the email server administrator and ask him to monitor the sending process in the background. After monitoring, he told me that every email sent should be connected to the server once, our server just performed a security baseline some time ago, and added a parameter, "Whether the mail sent by the SMTP session to be verified comes from the Internet address of the verified user, the purpose of this setting is to confirm that the user has not attempted to forge the "recipient" domain ". This may result in a long time to connect to the server for verification. The related information is as follows:


[454808: 00136-03743] 13:32:13 SMTP Server: localhost (10. 169. **. **) connected
[454808: 00136-03743] 13:32:13 SMTP Server: Authentication succeeded for user *******; connecting host 10. 169 .**.**
[454808: 00136-02218] 13:32:13 SMTP Server: Message 001E6A8C (MessageID:) received
[454808: 00136-03743] 13:32:13 SMTP Server: localhost (10. 169. **. **) disconnected. 1 message [s] received
[364650: 00020-04113] 13:32:13 Router: Message 001E6A8C delivered *******

[454808: 00136-02218] 13:32:30 SMTP Server: localhost (10. 169. **. **) connected
[454808: 00136-02218] 13:32:30 SMTP Server: Authentication succeeded for user *******; connecting host 10. 169 .**.**
[454808: 00136-03743] 13:32:30 SMTP Server: Message 001E710C (MessageID:) received
[454808: 00136-02218] 13:32:30 SMTP Server: localhost (10. 169. **. **) disconnected. 1 message [s] received
[364650: 00016-03085] 13:32:30 Router: Message 001E710C delivered *******

If the problem is that it takes a long time to verify the connection, can I verify whether multiple emails are sent continuously and then close them? I carefully checked Jmail. net parameters, Jmail. net does not provide this function. It can only connect to the server once each time an email is sent, its own group mail function is not suitable for the different purposes of each mail I want to achieve, and it is not suitable for searching some of the content on the Internet, finally, I decided to modify Jmail by myself.. Net.

Download to a decompilation source code of Jmail. Net (if you need to search for the source code by yourself, we will not provide it here), load VS2005, and start to read the code.

The automatic prompt during code writing shows that the sent code is sent by Dimac. jmail. smtp. send () to directly view Dimac. JMail. smtp. cs code. Locate the main function implementation code:

01 public void Send(Message message) 02 { 03      if (message == null ) 04      { 05          throw new ArgumentNullException( "message" , "Message cannot be null." ); 06      } 07      using (SmtpClient client = new SmtpClient( this .m_logStream)) 08      { 09          client.Connect( this .m_hostName, this .m_port); 10          client.Helo( this .m_domain); 11          client.Auth( this .m_authentication, ( this .m_userName == null ) ? string .Empty : this .m_userName, ( this .m_password ==
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.