How to write your own email component (principle)

Source: Internet
Author: User
Tags mail
First let's look at what the email component is and how it's done. The email component I'm talking about is used to send
Send email, not accept and deal with email, this we must understand. And the component itself is not
SMTP, so you need an SMTP server. ASP pages can send mail to the SMTP server by calling components, as long as SMTP is compliant.

Here we want to use the Winsock control, because the Winsock is a control, so it cannot be used where there is no form
。 Here are two solutions. The first one I saw from the newspaper, set up a form in the DLL, then put the Winsock on, and then write the code in the class module to create an instance of the form to use. But this method I tried, did not succeed, also do not know where there is a problem. Another method is to refer to the component, the next to have a browse button, you can select the desired OCX file, that is, the control, the use of methods and components is no different.

With the Winsock, the communication of the desire can be achieved, the use of specific Winsock I do not say, very simple
Single, you check the MSDN in less than half an hour to fully understand.

This is mainly about SMTP, want to understand more thoroughly, you can telnet to any SMTP server to get 25 end
Mouth, experiment.

When we set up the connection, also equal to you telnet to the SMTP server 25 port, there will be a welcome letter
Interest. Everybody pay attention to a number in the head of this information, which is the meaning of success, you can check in the program
The message from the other side whether there is this head, and some words to express success, the following steps have this information. Have
After the welcome message, issue helo and your domain name, such as Helo Etang. COM (I'm in this company), and then
The success of the words into the next step.

Hello finished, see how the server said, if you return a number and OK, that's fine, we'll send
Send mail from: Sender's email address.

After success, send RCPT TO: The address of the addressee.

The data is then sent, indicating that the text is entered and the body usually contains the From:, To:, Subjec
T:, then a carriage return, body, end with a carriage return.

Finally, send the quit instruction.

This is the entire process of Telnet:
>>220 W2. ETANGW2 ESMTP Server (Microsoft Exchange Internet Mail Servic
E 5.5.2650.21) Ready
HELO etang.com
>>250 OK
MAIL from:sender@etang.net
>>250 Ok-mail from <sender@etang.net>
RCPT to:recipients@etang.net
>>250 ok-recipient <recipients@etang.net>
DATA
>>354 Send data. End With CRLF. CRLF
From:sender@etang.net
To:recipients@etang.net
Subject:test

This is a Test letter
.
>>250 OK
QUIT

The previous >> represents the return information for the server.


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.