Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending email with ASP classic

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi

Although the code is ASP I am posting in the IIS forum as the code works on my Windows 2003 server but not my Windows 2008 server with IIS7.

My code is as follows:

Code:
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Test Email"
myMail.From="Ed Mozley <xxx@xxx.com>"
myMail.To="Ed Mozley <yyy@yyy.com>"
myMail.HTMLBody = "Test Email"
myMail.Send
set myMail=nothing

Works fine on IIS6 (2003 server but I get an error...

CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.

...on 2008 Server IIS7.

I have found the following changes work:

Code:
<%
Set cdoConfiguration = Server.CreateObject ("CDO.Configuration") 

With cdoConfiguration 
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "localhost" 
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25 
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 
.Fields("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60 
.Fields.Update 
End With

Set myMail=CreateObject("CDO.Message")
myMail.Configuration = cdoConfiguration 
myMail.Subject="Test Email"
myMail.From="Ed Mozley <xxx@xxx.com>"
myMail.To="Ed Mozley <yyy@yyy.com>"
myMail.HTMLBody = "Test Email"
myMail.Send
set myMail=nothing
%>

However I don't want to go through all my scripts if I can possibly avoid it changing this as there are a lot of them. SMTP is installed on the server but we also have an Exchange Server on the network - IIS6 SMTP has the Exchange server set as the smart host so it's all a bit of a dog's dinner.

Can the first version of the code be made to work by tinkering around with IIS or am I going to have to bite the bullet and update all my scripts?

Thanks very much

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top