New method for sending mail in Visual Basic 6

zhaozj2021-02-11  176

Author: Chen Gang with VB6 to write programs to send mail, Email a variety of components to choose from, such as MAPIMessages, IIS4.0 incidental CDONTS (NTS Collaboration Data Objects) as well as many third-party manufacturers to develop Email software. This article describes the mail program method under VB with CDONTS. 1. Confirm that the SMTP server has been installed First, you must confirm that the SMTP server has been installed on the IIS server, which is an option that is default the installation when installing Option Pack. If the SMTP server is installed, there will be a file named cdonts.dll in the System32 directory. 2. The simplest mail sender The following is the simplest mail sender, which makes a title "title" to ABC@263.net by me@hotmail.net: "Title", E-mail for "Hello": Private Sub Cmdsendmail_Click () Dim Objmail As Object Set Objmail = CreateObject ("cdfonts.dll") objmail.send "me@hotmail.net", "ABC@263.net", "Title", "Hello" set objmail = Nothing END SUB 3. Send Mail Accessories If there is an additional file requires mail transmission, you can use CDONTS's attachfile method: private subdsendmail_click () Dim objmail as object set objmail = createObject ("cdfonts.dll") with objmail .from = " Me@hotmail.net ".to =" abc@263.net ".subject =" title ".body =" hello ".attachfile" c: / document / sample.doc "," sample.doc ".send end with Set objmail = Nothing End Sub 4. CDONTS Components Common Properties and Method CDONTS Components Common Properties and Methods are listed below: Properties: Version: Return to the version of the CDONTS component MailFormat: Mail format, 1-normal text type; 0-MIME type CC : Set one or more email address from: mail sender's address to: mail recipient's address Subject: Title Body: content BodyFormat: Content format, 1-normal text; 0- Host text method: attachfile: Additional File ATTACHURL: Additional Address Send: Send Mail 5. E-Mail in Hypertext Format You must see many of the use of hypertext formats, but can also have pictures, sounds, and even embed animation. If you send you a friend, you will be able to bring him (she) unexpected surprise, because this is unable to use a general mail sender.

转载请注明原文地址:https://www.9cbs.com/read-5020.html

New Post(0)