CDONTS not supported

Discussion in 'ASP.NET / ASP.NET Core' started by windyhillgo, Jul 22, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I switched asp hosts. My original contact form used cdonts, which is not supported here.

    I replaced this:

    Set objMail = CreateObject("CDONTS.NewMail")
    objMail.To = strMailTo
    objMail.From = strMailFrom
    objMail.Subject = strMailSubject
    objMail.BodyFormat = 0
    objMail.Mailformat = 0
    objMail.Body = strMailBody
    objMail.Importance = cdoHigh
    objMail.Send
    Set objMail=nothing

    with this:

    set objMessage = createobject("cdo.message")
    set objConfig = createobject("cdo.configuration")

    ' Setting the SMTP Server
    Set Flds = objConfig.Fields
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
    Flds.update

    Set objMessage.Configuration = objConfig
    objMessage.To = "testing@my_domain.com"
    objMessage.From = "[email protected]"
    objMessage.Subject = "This is a sample email sent using CDO"
    objMessage.TextBody = "strMailBody"
    objMessage.fields.update
    objMessage.Send

    Response.write "Mail sent..."

    set objMessage = nothing
    set objConfig = nothing

    So far, so good. My form now sends to the address I specify in the TO field, so, coding wise, it works. But, not being an ASP programmer, I am unsure how to assign the form variables to the new coding. Before I do tons of research, I thought I would ask here for an answer.

    Thanks in advance. Rich
     
  2. Hi Rich,
    Is your site all in classic ASP?
    Any chance you'd like to do this in ASP.NET 2.0?
    Which ever way you want to go I can post some code for you.
    Salute,
    Mark
     
  3. Hello Mark, and thanks for the reply. Quite frankly, I don't know if the site is in classic or whatever. I checked the <head> for info, but I see no indicators saying anything seemingly relevant. Tell me what to look for and I will. Rich
     
  4. Hi,
    Look at the file extensions for your site pages.
    Classic ASP pages will look like this: default.asp
    Asp.net will look like this: default.aspx
     
  5. Mark, all the file extensions are .asp. That said, I am hosting the site here on discountASP.net, so any solution that works here works for me. Rich
     
  6. I'll whip something up, should be ready in 30 minutes unless my kids attack. [​IMG]
    http://blogcastrepository.com/photos/marks_shots/default.aspx
    Here ya go...Save all of this code to a page named contact.asp

     
  7. Mark, thanks for the code. Here's what I get at implementation:

    Subject:
    From:
    To:
    Message:

    CDO.Message.1 error '8004020d'
    At least one of the From or Sender fields is required, and neither was found.
    contact.asp, line 43



    The Subject, From, To, and Message lines above have a text box next to them, but, of course, they do not copy and paste.

    The error message is received immediately. There is no pause for the data input.

    Rich
     
  8. Hi,
    I didn't test it but from what I could tell that should have worked.


    How about doing this with the Persists e-mail component instead of CDO?
    http://www.aspemail.com/


    I do have a sample of that I did, that I know works,many of the customers here are using it already.
    It works much better than CDO too.
    http://www.aspemail.com/manual.html
    Salute,
    Mark
     
  9. Mark, I found some coding via a web search. Here's what I found:
    <!--StartFragment -->http://www.openhosting.co.uk/articles/serverside/5773/

    Anyway, I don't know how it differs from what you wrote. I plugged it in and away it went, which gets me out of my jam.

    I am sure that if I knew what I was doing, which I don't, your code would have worked perfectly.

    THANK YOU for your time and effort. I do appreciate it.

    Regards, Rich
     
  10. Good job bro. [​IMG]
     
  11. ///////////////////////////////////////////////////
    THE FOLLOWING IS MY CODE
    ////////////////////////////////////////////////////

    set objMessage = createobject('cdo.message')
    set objConfig = createobject('cdo.configuration')

    ' Setting the SMTP Server
    Set Flds = objConfig.Fields
    Flds.Item('http://schemas.microsoft.com/cdo/configuration/sendusing') = 2
    Flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver') = 'localhost'
    Flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpauthenticate') = 1
    Flds.update

    Set objMessage.Configuration = objConfig
    objMessage.To = '[email protected]'
    objMessage.From = '[email protected]'
    objMessage.Subject = 'This is a sample email sent using CDO'
    objMessage.TextBody = 'Congratulation' & VbCrLf & 'If you receive this is, your mail component works'
    objMessage.fields.update
    objMessage.Send

    Response.write 'Mail sent...'

    set objMessage = nothing
    set objConfig = nothing

    ///////////////////////////////////////////////////


    For some reason, I am not getting an error but I don't get an email. Any ideas?
     
  12. Hi,
    Personally I steer away fromCDO for mail.
    I always recommend either the Persists component for classic asp or an ASP.NET 2.0 method with validation.
    Looks like your site is in ASP.NET, would you like some code for ASP.NET mail?
    Salute,
    Mark
     
  13. Hey Mark,

    My only limitation is classic asp and hosted here at discount. I have the code on my page and I get nothing. No errors and no email. Weird.

    Any suggestions?

    Kris
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page