AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Jeff Allen
Expertise
I can answer basic to intermediate questions related to Classic ASP.I can answer Intermediate to Advanced questions CSS& HTML, and basic questions about JavaScript and Ajax. I can also answer questions related to web page accessibility under US Section 508.

Experience
I have 8 years experience with HTML. I have been developing in ASP, VBScript and CSS for two years each. I also currently work as web developer.

Organizations
IWA-HWG

Education/Credentials
I have a BA in English with minors in Web Design and Scientific and Technical Writing

 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > Using CDOSYS in ASP email for 1st time...can't resolve error...

Topic: Active Server Pages Programming (ASP)



Expert: Jeff Allen
Date: 9/22/2006
Subject: Using CDOSYS in ASP email for 1st time...can't resolve error...

Question
Jeff,

It is working for me now, but I have a new request related to this issue that I received. I completed a web page at http://hwashington.ccc.edu/excelbasic.htm that allows users to take a pre-test and the results are emailed to my work address (dmacklin@ccc.edu) via online form using CDOSYS. My processing page is an ASP page at http://hwashington.ccc.edu/excelbasic_process.asp which places the form contents into a database table, then emails me the data submitted via CDOSYS and then transfers control to a user confirmation page at http://hwashington.ccc.edu/excelbasic_confirm.htm.
I asked a contact of mine how could I have the data emailed to someone outside of my domail (ccc.edu), and he mentioned that I needed to you need to authenticate to my mail server with your email/pass instead of anonymous connecting (which I was attempting to do). My contact mentioned that he was not sure how its done in ASP but there must be some API with which you can authenticate to mail server with username and password. Do you have any background/suggestions on how this can be done, and what is an API and how would I use it in a case like this.
-------------------------

Followup To

Question -
Jeff,

Thanks for the tip. I was actually able to resolve  my problem by changing the code in the previous email to you listed below. The updated code is in the previous email below.

-------------------------

Followup To

Question -
Jeff,

Experimenting with email form in ASP at http://hwashington.ccc.edu/oit/oitreserve.asp. Processing page is at http://hwashington.ccc.edu/oit/sendmail.asp. I want the email to send a message that is formatted with line breaks to separate the different fields in the actual email message once the email is sent to the person who will receive the form contents.

Code is crashing in the With objMessage section (possibly due to strBody), and I can't figure out why:

Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"

Dim objConfig
Dim objMessage
Dim body 'Got an error using strBody...
Dim Fields

body = "Instructor name: " & Request.Form("iname") & "<br>" & "Instructor email: " & Request.Form("iemail") & "<br>" & "Instructor phone #: " & Request.Form("iphone") & "<br>" & "Computer Lab Requested: " & Request.Form("labnum") & "<br>" & "Date Lab Needed: " & Request.Form("date") & "<br>" & "Additional Audio/Visual Needs: " & Request.Form("avneeds")

Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

With Fields
 .Item(cdoSendUsingMethod) = 2
 .Item(cdoSMTPServer) = "mail2.ccc.edu"
 .Item(cdoSMTPServerPort) = 25
 .Item(cdoSMTPConnectionTimeout) = 10
 .Update
End With

Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig

With objMessage
 .To = Request.Form("receiver")
 .From = Request.Form("iemail")
 .Subject = Request.Form("subject")
 .HTMLBody = body 'Had to change this code also
 '.TextBody = strBody
 .Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing

Response.Redirect "http://hwashington.ccc.edu/oit/index3.asp"

Answer -
Is there a specific Error code you are receiving?
Have you looked at http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-with-cdo.html which explains how sending email with CDo works and http://classicasp.aspfaq.com/email/why-does-cdo-message-give-me-8004020f-errors.... which explains Why does CDO.Message give me 8004020F errors..



Answer -
So is this working for you now?

Answer
Well, now I have never had to do server authentication but Google has a lot of results where people are suthenticating CDOSYS emails (http://www.google.com/search?hs=iW8&hl=en&lr=&client=firefox-a&rls=org.mozilla%3...)

Normally however, I would think you would want to authenticate the user's email address before submitting data to dbase or sending any emails. Then once it is authenticated do all your processing...

This one (http://quadcomm.com/tips/sendCDOSYSmail.txt) has an example where they use the Configuration fields in CDO to set up amtpauthentication to basic (clear-text) like so:
' Specify the authentication mechanism to basic (clear-text) authentication.
  .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.