Lm th? no ? s? d?ng CDONTS ? thu th?p v thng tin th t? m?t ng?i s? d?ng

D?ch tiu ? D?ch tiu ?
ID c?a bi: 186204
Bung t?t c? | Thu g?n t?t c?


Bi vi?t ny ch?a m?t v d? m m t? lm th? no ? thu th?p thng tin t? m?t ng?i s? d?ng trn m?t.HTM trang, v sau s? d?ng thng tin ? g?i th ?n m?t ng?i nh?n b?ng cch s? d?ng h?p tc d? li?u ?i t?ng cho Windows NT Server (CDONTS) qua SMTP. Bi vi?t ny bao g?m cc m?u m? cho HTM v ASP t?p tin nh c?ng nh thng tin v? cch c?u h?nh c?a b?n Microsoft Management Console My ch? SMTP c?a (MMC) m?c ?nh.


C php ? g?i th v?i cc ?i t?ng NewMail c?a CDONTS l nh sau:
   objNewMail.Send([From][, To][, Subject][, Body][, Importance] )

      Required. This NewMail object.

      Optional. String. The full messaging address to be identified as
      the sender (for example, someone@Microsoft.com)

     Optional. String. A list of full messaging addresses of recipients.
     The individual recipient addresses are separated by semicolons.
     (for example, someone@Microsoft.com)

      Optional. String. The subject line for the message.

      Optional. IStream object or String. The text of the message. Only
      C/C++ and Java programs can use an IStream object for the Body
      parameter. They should pass an IUnknown object that returns an
      IStream interface in response to QueryInterface. Microsoft Visual
      Basic supports the IDispatch interface and not IUnknown, so it
      cannot use an IStream object.

      Optional. Long. The importance associated with the message, High,
      Normal or Low.  This article sets the required value depending upon
      which option button the user selects.

  1. Sao chp v dn o?n m? HTML sau vo m?t t?p tin tn CDONTSMail.HTM:
          <meta http-equiv="Content-Type"
          content="text/html; charset=iso-8859-1">
          <meta name="GENERATOR"
          content="Microsoft FrontPage (Visual InterDev Edition) 2.0">
          <body bgcolor="#FFFFFF">
          <form action="CDONTSMail.asp" method="POST">
          <table border="0">
                <td><!--webbot bot="Validation"
                   b-value-required="TRUE" --><input type="text"
                   size="47" name="txtFrom"
                   value="Your internet address (Me@MyCompany.com)"></td>
                <td><!--webbot bot="Validation"
                   b-value-required="TRUE" --><input type="text"
                   size="47" name="txtTo"
                   value="The recipient's address (You@YourCompany.com)"></td>
                <td><input type="text" size="47" name="txtSubject"
                   value="Enter a subject here"></td>
                <td valign="top">Message:</td>
                <td><textarea name="txtMessage" rows="9" cols="45">
                   Type your message here.</textarea></td>
                <td valign="top">Importance:</td>
                <td><input type="radio" name="optImportance"
                   <input type="radio" checked name="optImportance"
                   <input type="radio" name="optImportance" value="0">Low<br>
          <p><input type="submit" name="cmdSubmit" value="Submit">
          <input type="reset" name="cmdClear" value="Clear"> </p>
  2. Dn m? VBScript sau vo m?t t?p tin tn CDONTSMail.ASP:
          <%@ LANGUAGE="VBSCRIPT" %>
          <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
          <META HTTP-EQUIV="Content-Type"
          Sub Write(strWriteThis)
             'This subroutine just writes out whatever is
             'passed to it.
             response.write(strWriteThis & "<br>")
          end sub
             Dim myCDONTSMail
             Dim strFrom
             Dim strTo
             Dim strSubject
             Dim strMessage
             Dim lngImportance
             'The following variable assignments are not required
             'they are just here to make interpretation of the
             'myCDONTSMail.Send line easier.  You could put the
             'Request.Form statements in the .Send line to cut down
             'on the amount of code in the file.
             strSubject = request.form("txtSubject")
             lngImportance = request.form("optImportance")
             'The following four lines of code are just here for test
             'purposes to see what variables have been pulled in from the
             'HTM form.
             Write("strFrom = " & strFrom)
             Write("strTo = " & strTo)
             Write("strSubject = " & strSubject)
             Write("strMessage = " & strBody)
             Write("Importance = " & lngImportance)
             Set myCDONTSMail = CreateObject("CDONTS.NewMail")
             myCDONTSMail.Send strFrom,strTo,strSubject,strBody,lngImportance
             Set myCDONTSMail  = Nothing
             Write "Mail has been sent."
    LU ?: ?i t?ng NewMail s? tr? thnh khng h?p l? sau khi hon thnh phng th?c g?i, v b?n khng th? ti s? d?ng n cho m?t tin nh?n. B?n nn ?t n ? khng c g? ? gi?i phng b? nh?. ? c? g?ng truy c?p ?n m?t k?t qu? ?i t?ng NewMail ? g?i trong l?i c?a CdoE_INVALID_OBJECT.
  3. B?c ? c?u h?nh c?a b?n Internet Information Server (IIS). ? g?i th t? my ch? IIS c?a b?n thng qua my ch? SMTP c?a b?n (gi? ?nh r?ng h? l cc my tnh khc nhau), hon thnh sau y b?c sau:

    1. Trn my tnh IIS, m? qu?n l? giao di?n i?u khi?n Microsoft (MMC).
    2. Trong ngn bn tri, m? r?ng "Internet thng tin my ch?" ke tiep.
    3. Trong ngn bn tri, ch?n v m? r?ng c?a b?n my ch? IIS.
    4. Trong ngn bn ph?i, b?m chu?t ph?i vo "Default SMTP server" v ch?n "Ti s?n"
    5. Ch?n tab "Phn ph?i".
    6. Trong h?p vn b?n "Hon ton ? i?u ki?n tn mi?n", nh?p cc IIS tn my tnh.
    7. Trong h?p vn b?n "Thng minh ch?", nh?p tn my ch? SMTP c?a b?n.
  4. Ch?y t?p tin CDONTSMail.htm trong tr?nh duy?t c?a b?n, nh?p vo cc yu c?u thng tin, v sau ch?n nt g?i.

    LU ?: M? ? trn ?i h?i b?n ph?i nh?p gi tr? trong t? v ? cc l?nh v?c.


C?ng tc d? li?u ?i t?ng gip; t?m ki?m trn "c?ng tc d? li?u ?i t?ng cho NTS ph?n"; ch? ?: "NewMail ?i t?ng (CDONTS th vi?n)"

Thu?c tnh

ID c?a bi: 186204 - L?n xem xt sau cng: 20 Thang Tam 2011 - Xem xt l?i: 2.0
T? kha:
kbhowto kbhtml kbmsg kbmt KB186204 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:186204
Khc t Ni dung trong C s Kin thc Khng con c h tr
Bi vi?t ny ni v? cc s?n ph?m m Microsoft khng c?n h? tr? n?a. Do , bi vi?t ny ?c cung c?p "nguyn b?n" v s? khng ?c c?p nh?t.

Cung cp Phan hi


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com