Let's play with the mail function. Of course, we cannot send emails to Perl or PHP! We still need to use components. However, you do not need to spend any money on this component! It is self-contained in SMTP in IIS! Let's use the email sending function for a flash!
Set CDO = server. Createobject ("cdonts. newmail ")
CDO. Send "webmaster@aspcn.com", "dd@263.net", "ASP Chinese network Letter", "Hello! ", 0
Set CDO = nothing
!!!!??? That's short !!! Impossible!
Hey hey, you try. If you have a server, change the dd@263.net to your email, and then put thisCodeGet the above and try it. You will be able to receive the letter!
This is the most direct method for sending emails! Format:
CDO. Send fromaddress, toaddress, subject, body, importance
Of course, we can make it more complex. Let's take a look and write the above example into detail!
Set CDO = server. Createobject ("cdonts. newmail ")
CDO. From = "webmaster@aspcn.com"
CDO. To = "dd@263.net"
CDO. Subject = "ASP Chinese net letter"
CDO. Body = "Hello! "
CDO. mailformat = 0
CDO. bodyformat = 0
CDO. Importance = 0
CDO. Send
Set CDO = nothing
So everyone can see it clearly!
Here are some explanations!
Importance indicates the importance of an email. 0 indicates low importance, 1 indicates normal, and 2 indicates high importance.
Bodyformat refers to the body format of an email. 0 indicates the HTML format, and 1 indicates the plain text.
Mailformat refers to the Message format, text message (1), or MIME format (0)
We can add attachments to emails with only one sentence:
CDO. attachfile "C:/du/asp.gif"
Easy!
All right, there are so many emails. You can try to send your first mail from ASP!