Microsoft KB Archive/248734: Difference between revisions
m (Text replacement - "\[\[..\/URJump\|Q\d{5,6}\]\]" to "\[\[..\/$1\|Q$1\]\]") |
m (Text replacement - """ to """) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 57: | Line 57: | ||
'''NOTE''': After compiling the project in Visual Basic 6, copy Project1.exe , Project1.vbr and Project1.tlb to an appropriate folder. On the SMTP Server Open file explorer double-click on the Project1.exe, so it registers automatically.<br /> | '''NOTE''': After compiling the project in Visual Basic 6, copy Project1.exe , Project1.vbr and Project1.tlb to an appropriate folder. On the SMTP Server Open file explorer double-click on the Project1.exe, so it registers automatically.<br /> | ||
<br /> | <br /> | ||
You can alternatively run | You can alternatively run "Project1.exe /REGSERVER" from the command line manually.<br /> | ||
<br /> | <br /> | ||
Execute the following script at SMTP Server's command prompt in order to remotely register the class to IIS.<br /> | Execute the following script at SMTP Server's command prompt in order to remotely register the class to IIS.<br /> | ||
<br /> | <br /> | ||
<pre class="CODESAMP">clireg32.exe project1.vbr -s | <pre class="CODESAMP">clireg32.exe project1.vbr -s <IISServerHostName> -t project1.tlb -d </pre> | ||
Visual Basic 6 Project Source Code:<br /> | Visual Basic 6 Project Source Code:<br /> | ||
Line 76: | Line 76: | ||
Public Sub SendMail() | Public Sub SendMail() | ||
Dim objNewMail As CDONTS.NewMail | Dim objNewMail As CDONTS.NewMail | ||
Set objNewMail = CreateObject( | Set objNewMail = CreateObject("CDONTS.NewMail") | ||
objNewMail.From = strFrom | objNewMail.From = strFrom | ||
objNewMail.To = strTo | objNewMail.To = strTo | ||
objNewMail.Subject = | objNewMail.Subject = "This is a test message" | ||
objNewMail.Body = strBody | objNewMail.Body = strBody | ||
objNewMail.Value( | objNewMail.Value("Reply-To") = strReply_To | ||
objNewMail.BodyFormat = intBodyFormat | objNewMail.BodyFormat = intBodyFormat | ||
objNewMail.MailFormat = intMailFormat | objNewMail.MailFormat = intMailFormat | ||
Line 91: | Line 91: | ||
Sample ASP code that works as the DCOM client on IIS.<br /> | Sample ASP code that works as the DCOM client on IIS.<br /> | ||
<pre class="CODESAMP"> | <pre class="CODESAMP"><%@ LANGUAGE="VBSCRIPT" %> | ||
<% | |||
Option Explicit | Option Explicit | ||
Dim myCDONTSMail | Dim myCDONTSMail | ||
Line 106: | Line 106: | ||
Const CdoHigh = 2 ' High importance | Const CdoHigh = 2 ' High importance | ||
' Create the CDONTS NewMail object | ' Create the CDONTS NewMail object | ||
Set myCDONTSMail = CreateObject( | Set myCDONTSMail = CreateObject("myCDONTS.class1") | ||
myCDONTSMail.strFrom = | myCDONTSMail.strFrom = "yourFromAddress@domain.com" | ||
myCDONTSMail.strTo = | myCDONTSMail.strTo = "intendedRecipient@anotherdomain.com" | ||
myCDONTSMail.strSubject = | myCDONTSMail.strSubject = "This is the Subject" | ||
myCDONTSMail.strBody = | myCDONTSMail.strBody = "This is the message body." | ||
myCDONTSMail.strReply_To = | myCDONTSMail.strReply_To = "Reply-To<yourFromAddress@domain.com>" | ||
myCDONTSMail.intBodyFormat = CdoBodyFormatText | myCDONTSMail.intBodyFormat = CdoBodyFormatText | ||
myCDONTSMail.intMailFormat = CdoMailFormatText | myCDONTSMail.intMailFormat = CdoMailFormatText | ||
Line 118: | Line 118: | ||
myCDONTSMail.SendMail | myCDONTSMail.SendMail | ||
Set myCDONTSMail = Nothing | Set myCDONTSMail = Nothing | ||
% | %> </pre> | ||
'''WARNING''': Make sure that IIS MetabaseSetting is set to allow out of process components on the IIS Server.<br /> | '''WARNING''': Make sure that IIS MetabaseSetting is set to allow out of process components on the IIS Server.<br /> | ||
<br /> | <br /> | ||
Set AspAllowOutOfProcComponents to | Set AspAllowOutOfProcComponents to "1" by using METAEDIT.exe from IIS Resource Kit, or use ADSUTIL.vbs with relevant parameters.<br /> | ||
<br /> | <br /> | ||
For additional information, please see the following article(s) in the Microsoft Knowledge Base:<br /> | For additional information, please see the following article(s) in the Microsoft Knowledge Base:<br /> | ||
Line 132: | Line 132: | ||
</p> | </p> | ||
<blockquote>\[\[..\/\|Q\]\] DCOM Client Hangs and Then Gives Error 429</blockquote></li> | <blockquote>\[\[..\/\|Q\]\] DCOM Client Hangs and Then Gives Error 429</blockquote></li> | ||
<li>Run DCOMCNFG.exe. Select Project1.SendMail and click '''Properties''' and then set | <li>Run DCOMCNFG.exe. Select Project1.SendMail and click '''Properties''' and then set "Authentication Level" to None. This is done because you do not want to suffer from NTLM authorization three round trips. You can prefer any authentication level depending on your needs.</li></ol> | ||
<br /> | <br /> |
Latest revision as of 13:51, 21 July 2020
The information in this article applies to:
SUMMARYBy using the DCOM technology with the CDONTS.NewMail component, you can send e-mail from an ASP Web page without having an SMTP server installed on the Internet Information Server 4.0 (IIS) computer that you want to initiate the send on. Therefore, installing the SMTP service may be omitted on the IIS. IIS4 as DCOM client
SMTP server with a custom DCOM EXE server using the CDONTS.NewMail component.
MORE INFORMATIONCreate a sample Visual Basic project with the following options and settings: Project Type: ActiveX EXE Project Name: Project1 Class Instancing: MultiUse Class Name: SendMail Other project settings/options: check Unattended Execution check Upgrade ActiveX Controls select ActiveX Component check Remote Server Files select Binary Compatibility set Thread Pool to 10 threads NOTE: After compiling the project in Visual Basic 6, copy Project1.exe , Project1.vbr and Project1.tlb to an appropriate folder. On the SMTP Server Open file explorer double-click on the Project1.exe, so it registers automatically. clireg32.exe project1.vbr -s <IISServerHostName> -t project1.tlb -d Visual Basic 6 Project Source Code: Option Explicit Public strFrom As Variant Public strTo As Variant Public strReply_To As Variant Public strSubject As Variant Public strBody As Variant Public intBodyFormat As Integer Public intMailFormat As Integer Public intImportance As Integer Public Sub SendMail() Dim objNewMail As CDONTS.NewMail Set objNewMail = CreateObject("CDONTS.NewMail") objNewMail.From = strFrom objNewMail.To = strTo objNewMail.Subject = "This is a test message" objNewMail.Body = strBody objNewMail.Value("Reply-To") = strReply_To objNewMail.BodyFormat = intBodyFormat objNewMail.MailFormat = intMailFormat objNewMail.Importance = intImportance ' Send the message and cleanup CDONTS objects objNewMail.Send Set objNewMail = Nothing End Sub Sample ASP code that works as the DCOM client on IIS. <%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit Dim myCDONTSMail '---- BodyFormat Property ---- Const CdoBodyFormatHTML = 0 ' The Body property is to include Hypertext Markup Language (HTML). Const CdoBodyFormatText = 1 ' The Body property is to be exclusively in plain text (default value). '---- MailFormat Property ---- Const CdoMailFormatMime = 0 ' The NewMail object is to be in MIME format. Const CdoMailFormatText = 1 ' The NewMail object is to be in uninterrupted plain text (default value). '---- Importance Property ---- Const CdoLow = 0 ' Low importance Const CdoNormal = 1 ' Normal importance (default) Const CdoHigh = 2 ' High importance ' Create the CDONTS NewMail object Set myCDONTSMail = CreateObject("myCDONTS.class1") myCDONTSMail.strFrom = "yourFromAddress@domain.com" myCDONTSMail.strTo = "intendedRecipient@anotherdomain.com" myCDONTSMail.strSubject = "This is the Subject" myCDONTSMail.strBody = "This is the message body." myCDONTSMail.strReply_To = "Reply-To<yourFromAddress@domain.com>" myCDONTSMail.intBodyFormat = CdoBodyFormatText myCDONTSMail.intMailFormat = CdoMailFormatText myCDONTSMail.intImportance = CdoNormal ' Send the message and cleanup CDONTS objects myCDONTSMail.SendMail Set myCDONTSMail = Nothing %> WARNING: Make sure that IIS MetabaseSetting is set to allow out of process components on the IIS Server.
Check the Registry and DCOM permissions to see if they are correct on SMTP Server.
REFERENCESFor additional information, please see the following article(s) in the Microsoft Knowledge Base:
Additional query words: CDONTS SMTP IIS DCOM COM VB ASP Keywords : kbASP kbIIS |
Last Reviewed: January 13, 2000 |