Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP Form using CDO - no email sending

    I am a CF programmer, but need to figure out how to send a form via ASP. All I need to do is submit a form. I downloaded the sendmail_cdo code from this website and it says it should work.

    http://www.codeproject.com/asp/sendmail.asp

    My form submits, but no email sends. Do I need to register something on the server? They are running Windows 2000 / Exchange 2000 and I have the SMTP if needed. What could be causing no emails to send. Again, I don't work with ASP so I am not getting far so any help would so be greatly appreciated.

    Or could someone direct me to code that will work more easily?

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Here is one that I wrote that is a bit simpler to use.

    This is easily altered just by changing the actual fields with the fields from your form.


    Code:
    Dim theMessage
    
    theMessage = "First Name :" & RequestForm("FirstName") & "<br>" & _
    	"Last Name :" & RequestForm("LastName") & "<br>" & _
    	"Address :" & RequestForm("Address") & "<br>" & _
    	"City :" & RequestForm("City") & "<br>" & _
    	"State :" & RequestForm("State") & "<br>" & _
    	"Telephone :" & RequestForm("Telephone") & "<br>" & _
    	"Comments :" & RequestForm("Comments") 
    
    
    Call SendEmail(Request.Form("Recipient"), Request.Form("Sender"), Request.Form("EmailSubject"), theMessage)
    
    Sub SendEmail(ByVal sTo, ByVal sFrom, ByVal sSubject, ByVal sMessage)
    	Dim oMail
    	Set oMail = Server.CreateObject("CDO.Message")
    	With oMail
    		.To = sTo
    		.From = sFrom
    		.Subject = sSubject
    		.HTMLBody = sMessage
    		'.TextBody = sMessage     uncomment if you want to send a plain text email  
    	End With
    	oMail.Send()
    	Set oMail = Nothing
    End Sub

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you. I used that code, but it brings up a http 500 internal error. Do I need some sort of configurations?

  • #4
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Turn your friendly errors off in your browser settings, this will display the error. Then you can post the error so that we can see what the problem is.

    in IE tools > Internet Options > click the Advanced tab >under the Browsing category scroll down to Show friendly HTTP error messages and uncheck it

  • #5
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you.

    I got this error:

    Microsoft VBScript runtime error '800a000d'

    Type mismatch: 'RequestForm'

    /sendmail3.asp, line 4

  • #6
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    oops my errror . thats what happens when I use cut/paste. typos get carried over. grrrr. use this code instead of the first example


    Code:
    Dim theMessage
    
    theMessage = "First Name :" & Request.Form("FirstName") & "<br>" & _
    	"Last Name :" & Request.Form("LastName") & "<br>" & _
    	"Address :" & Request.Form("Address") & "<br>" & _
    	"City :" & Request.Form("City") & "<br>" & _
    	"State :" & Request.Form("State") & "<br>" & _
    	"Telephone :" & Request.Form("Telephone") & "<br>" & _
    	"Comments :" & Request.Form("Comments") 
    
    
    Call SendEmail(Request.Form("Recipient"), Request.Form("Sender"), Request.Form("EmailSubject"), theMessage)
    
    Sub SendEmail(ByVal sTo, ByVal sFrom, ByVal sSubject, ByVal sMessage)
    	Dim oMail
    	Set oMail = Server.CreateObject("CDO.Message")
    	With oMail
    		.To = sTo
    		.From = sFrom
    		.Subject = sSubject
    		.HTMLBody = sMessage
    		'.TextBody = sMessage     uncomment if you want to send a plain text email  
    	End With
    	oMail.Send()
    	Set oMail = Nothing
    End Sub
    Last edited by miranda; 06-27-2007 at 07:08 PM.

  • #7
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    coolio... The form submits with no error, but now I don't get the email sent. I read somewhere you need to have something configured?

  • #8
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nevermind!!! It worked!!! Thanks!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •