问题
I want to configure the smtp server on iis7. Its a website done on classic asp from which i am sending email. I get the error code as -2147220973.
I have configured the email address and stmtp server name in IIS 7
Is there anything else need to be configured ? or what is the error code means ?
回答1:
CDOSYS Error: Error Number: -2147220973 Error Source: CDO.Message.1 Error Description: The transport failed to connect to the server.
Looks like IIS is not able to connect to SMTP server, make sure you are using the correct SMTP server, some web hosts, such as GoDaddy require you to use their SMTP server to control spam issues. Check you web hosts support documentation. Also CDOSYS, the e-mail component used in ASP doesn't read the IIS configuration, as in IIS 7 that is used for ASP.NET and not ASP Classic. IIS 7 is configured by default to use localhost.
Take a look at the code below and make sure your code is using the correct SMTP server.
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>
http://www.w3schools.com/asp/asp_send_email.asp
I have also written a simple ASP function that uses a Dictionary object to send e-mail with CDOSYS. That can make sending e-mail a little bit easier in ASP Classic.
http://www.simplecontactus.com
来源:https://stackoverflow.com/questions/6465296/configuring-smtp-in-iis-7-for-sending-emails-from-classic-asp-application