Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1819474
  • 博文数量: 354
  • 博客积分: 11021
  • 博客等级: 上将
  • 技术积分: 4048
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-24 10:04
文章存档

2020年(1)

2018年(1)

2016年(1)

2015年(2)

2014年(4)

2013年(4)

2012年(12)

2011年(14)

2010年(37)

2009年(34)

2008年(22)

2007年(68)

2006年(102)

2005年(29)

2004年(21)

分类:

2006-09-12 10:55:02

 
网上很多关于如何用CDONTS.DLL来发邮件的方法,试过之后都不行,最后还是用CDO的方法来实现的。
 
 
 
Title: CDONTS on Windows 2003 Server
asked by BetsyV on 11/07/2003 06:40AM PST
 

I've been working with CDONTS email messaging for quite a while on a Windows 2000 server that also had SQL 2000 installed on it.  This server was our Intranet server so it had IIS on it too.  I had a SQL stored procedure that sent the mail, and all worked perfectly.
Recently, we purchased 2 new servers to replace the old one.  We decided to load Windows 2003 and put the SQL databases on one server (HMCNTDOCSQL) and the web services (IIS on a different server -- HMCNTDOC1). The SMTP service is running on HMCNTDOC1,a nd I set it up with the correct name of our SMTP server.  As you can probably guess, it isn't working any more.  I'm using the same SQL stored procedure, and no emails.
Yesterday, I edited this code into my web page (.asp):
Dim MyBody
Dim MyCDONTSMail
Set MyCDONTSMail=CreateObject("CDONTS.NewMail")
MyCDONTSMail.From=""
MyCDONTSMail.To=""
MyCDONTSMail.Subject="Test"
MyBody="I Hope This Works"
MyCDONTSMail.Body=MyBody
MYCDONTSMail.Send
set MyCDONTSMail=nothing
When I use this, I get the following error message: 
Microsoft VBScript runtime error '800a01ad'
ActiveX component can't create object: 'CDONTS.NewMail'
/ITChangeNotification/IT/Insert.asp, line 57

I think the code is correct, so I'm wondering if there is something I missed in setting up IIS.
Any suggestions?
 
======
DONTS was depreciated and you need to use CDO instead, it isn't a massive change here is a template
     Set objErrMail= Server.CreateObject("CDO.Message")
     With objErrMail
          .From = "From Address<>"
          .To = ""
          .Subject = "Subject Line"
          .HTMLBody = CStr("" & strBody)
          .Configuration.Fields.Item ("") = 2
          .Configuration.Fields.Item("") = "IP of smtp server"
          .Configuration.Fields.Item("") = 25
          .Configuration.Fields.Update
          .Send
     End With
 
TESTED
=====
 
I think I'm closer, but still getting an error.  When I added the above code to my page, I get the following:
CDO.Message.1 error '8004020a'
The SMTP server name is required, and was not found in the configuration source.
I have the IP address of the smtp server, but do I also need a line for the server name?
Thanks !!
Comment from fz2hqs
Date: 11/07/2003 07:59AM PST Comment 
Comment from BetsyV
Date: 11/07/2003 08:12AM PST Author Comment 
Thanks so much.  I found my error.  I had the IP of our smtp server, and should have put the name.  Once I fixed this, it worked great.
I really appreciate the help.
Comment from kmiller7
Date: 12/01/2003 10:52PM PST Comment 
I need help converting a mail script from CDONTS to CDO script.  I know just enough to make other peoples code work but I am having trouble converting this code I already have to work properly.
Thank you for any Help!!

<%
Dim strSender
Dim strRecipientsName
Dim strRecipients
Dim strSubject
Dim strMessage
strRecipientsName = Request.Form("Name")
strRecipients = Request.Form("Email")
strSubject = "From: " & Request.Form("YName") & " Picture"
strMessage = "Hello " & Request.Form("Name") & vbCrLf & vbCrLf
strMessage = strMessage & Request.Form("Msg") & vbCrLf & vbCrLf
strMessage = strMessage & "You received this from : " & Request.Form("YName") & " " & Request.Form("YEmail")
strSender = Request.Form("YEmail")
%>
<%
          Set objNewMail = Server.CreateObject ("CDONTS.NewMail")
                objNewMail.cc = ""
          objNewMail.BodyFormat = 1
          objNewMail.MailFormat = 0
          on error resume next '## Ignore Errors
          objNewMail.Send strSender, strRecipients, strSubject, strMessage
          If Err <> 0 Then
               Err_Msg = Err_Msg & "
  • Your request was not sent due to the following error: " & Err.Description & "
  • "
              End if
              on error resume next '## Ignore Errors
    Set objNewMail = Nothing
    %>
    Comment from fz2hqs
    Date: 12/02/2003 01:26AM PST Comment 
    kmiller7 - Don't jump in other peoples threads, start one of your own
    Comment from vbishop
    Date: 02/10/2004 09:53AM PST Comment 
    Excellent bit of code fz2hqs!
    The Internet Community Appreciates it!
    The code worked perfectly the first time I tried it!
    Best,
    Vincil Bishop
    Comment from varun_minhas
    Date: 04/05/2004 01:50PM PDT Comment 
    Hi, I'm new here but my question is on topic. I'm currently upgrading to server 2003 with exchange 2003 (fresh installation) and nothing as far as forms seems to want to work. As far as I remember with server 2000, all you had to do was change the appilcation pool under the website properties to "Low IIS processed" but with the new system I cannot seem to get forms to work. The error message I receive is as follows:
     
    Server object error 'ASP 0177 : 800401f3'
    Server.CreateObject Failed
    /membership.asp, line 42
    800401f3
    On top of which my current server 2000 with exchange server 2000 seem to keep freezing. Virtually everyday or ever other day I have to come in and restart the machine. It just falls asleep and never gets back up. I've check all the power management settings, etc. They are highly unreliable and I need to get some stable machines working.
    Please help. 
    Comment from vbishop
    Date: 04/05/2004 02:42PM PDT Comment 
    varun_minhas -
    More than happy to help.
    Please start a new thread, then email me the link:
    {{email address removed for member's protection --alimu/Page Editor IIS}}
    Many times I have found that MS Servers behave better if they get their daily reboot.
    The error appears as if you are trying to use an activex dll that is not registered.
    Best,
    Vincil Bishop
    {{website address removed as per: http:/help.jsp#hi106 --alimu/Page Editor IIS}}
    Comment from mrnmnew
    Date: 02/08/2005 09:05AM PST Comment 
    or you could add CDONTS to windows 2003 :
    To copy CDONTS to a computer running Windows Server 2003
    On the source server, copy Cdonts.dll from the systemroot\system32 folder to a floppy disk.
    On the target server, copy Cdonts.dll from the floppy disk to the folder systemroot\system32.
    To register CDONTS, on the target server, in the Run dialog box, type cmd, and then click OK.
    At the command prompt, change to the systemroot\system32 directory, and then type:
    regsvr32 windir\system32\cdonts.dll
    If the process is successful, the following message displays:
    DllRegisterServer in cdonts.dll succeeded.
    Click OK.
    Comment from smilbandit
    Date: 09/20/2005 05:33AM PDT Comment 
    I could not get it to run using a cdonts.dll from a windows nt install.  I'm not sure where I got it but I had another cdonts.dll on my windows 2000 install that was bigger in file size (~400k) and that worked fine.  The version of the file I used is 6.0.3940.15 and said that it was from microsoft exchange.
    阅读(3080) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~