C # email sending server (sending with a pseudo-others' email address)

Source: Internet
Author: User
Tags nslookup

Amount: the home page has been removed. Okay, I'm writing more details.

I originally wanted to be a mailbox server of my own. I checked some of the received messages after the Protocol, but it felt too insecure, so I went to speed up the Mailbox System of other large companies and checked whether it was safe. The test showed that Netease's 163 mailbox server looked like someone else's, rather than self-developed by Netease... Starting the test, we found that the reception was successful... However, Netease seems to have to queue up sometimes, and qq is better, but it is usually sent to the last step to give me a 550, and sometimes it is okay to send some emails, It is very depressing, I haven't gotten it out for a long time, so I am sending it to ask my sister-in-law for help.

Class Program {static void Main (string [] args) {// 113.108.77.23 // more server nslookup-qt = mx qq.com // 163mx02.mxmail.netease.com // 163 mailbox more server nslookup-qt = mx 163.com System. net. sockets. tcpClient client = new System. net. sockets. tcpClient ("163mx03.mxmail.netease.com", 25); // connect to the server that receives the email byte [] bytes = new byte [80]; var count = client. client. receive (bytes); // receives the status information returned by the server var sendServer = System. text. E Ncoding. ASCII. getString (bytes); // The 220 Console is returned. writeLine (sendServer); client. client. send (System. text. encoding. ASCII. getBytes ("HELO m1.163.com \ r \ n"); // send HELO information bytes = new byte [80]; count = client. client. receive (bytes); // receives the status information returned by the server sendServer = System. text. encoding. ASCII. getString (bytes); // The 250 Console is returned. writeLine (sendServer); client. client. send (System. text. encoding. ASCII. getBytes ("mail from: <System@net.cn> \ r \ n "); // notify the sender of the Server Message bytes = new byte [80]; count = client. client. receive (bytes); // receives the status information returned by the server sendServer = System. text. encoding. ASCII. getString (bytes); // If 250 is returned, you can continue; otherwise, the Console cannot continue. writeLine (sendServer); client. client. send (System. text. encoding. ASCII. getBytes ("rcpt to: <136420351@163.com> \ r \ n"); // you can cycle through this step TO notify the server of multiple email addresses for receiving mail, however, the returned information must be received in bytes = new byte [80]; count = client. client. receiv E (bytes); // receives the status information returned by the server sendServer = System. text. encoding. ASCII. getString (bytes); // If 250 is returned, you can continue; otherwise, the Console cannot continue. writeLine (sendServer); client. client. send (System. text. encoding. ASCII. getBytes ("DATA \ r \ n"); // notify the server that the email contains bytes = new byte [80]; count = client. client. receive (bytes); // receives the status information returned by the server sendServer = System. text. encoding. ASCII. getString (bytes); // If 354 is returned, you can continue; otherwise, the Console cannot continue. writeLine (sendServer); String data = @ "From: 1049099499 <system@net.cn> To: 1049099499 <136420351@163.com> Content-Type: text/plain; charset = UTF-8Content-Transfer-Encoding: base645LiN5aW95oSP5oCd77yM5ou/5L2g6YKu566x5Y + R5LqG5Liq6YKu5Lu2LeOAgi3vvIE = ------ = _ Part_161944_1210153027.551452414. "; client. client. send (System. text. encoding. ASCII. getBytes (data); // the content of the email, which is Base64 encoded. "Sorry, I sent an email-from your mailbox -. -!" Console. writeLine ("Data Transmission completed"); bytes = new byte [80]; count = client. client. receive (bytes); // receives the status information returned by the server sendServer = System. text. encoding. ASCII. getString (bytes); Console. writeLine (sendServer); // If 250 is returned, 550 is successful, and 451 is failed. The failure rate of the email sent to qq is very high. I don't know why, is also a failure, but I don't know what Console. read ();}}

Note: 1. the sender and recipient cannot be the same server. For example, the qq mailbox cannot be sent to the qq mailbox, and the server will reject
2. The sending failure rate is very high. I don't know why. I tested and simplified the mail content, and completed the same. Please solve it with experts.
3. I have no plans to launch or clean up resources. The failure rate is quite high.
4. I use the same content. I sent a 163 email to a qq account with a success rate of 100%. However, I failed to receive the email from another qq account. I don't know why.

I hope that the Big Brother and sister will find out the cause of the failure or make it a high success rate. If the big brother and sister who have a higher success rate can tell me, the younger brother is grateful and disrespectful -. -!

Reprinted please indicate the source: happy you and me-happy programming http://www.happyyouandme.com

 

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.