submitting form once results in multiple e-mails received...sometimes

Discussion in 'ASP General' started by Chris Baker, Jan 2, 2006.

  1. Chris Baker

    Chris Baker Guest

    This is a problem I have been troubleshooting for about 4-6 months. I
    have an e-mail form on a client's public website that is mis-behaving.
    It is written in ASP and uses a CDO.Message object. there is only one
    call to the Send method. The problem occurs with and also without a
    CDO.Configuration set to the Message.

    When I test the form from my computer, it acts normally, sending only
    one message, and I receive only one message; however, when I send the
    form from my client's office (his computer), 2 to 3 message are
    received. The Message-IDs are different. The form writes unique
    date/time information to a file each time a message is sent, so I know
    that the code is being executed multiple times.

    This appears to be a problem with either his network or his computer,
    but I don't know where to start. The code works fine, but I'll paste
    it in anyway. Any thoughts would be appreciated!

    <code>
    ' The values passed into this function should be validated already.
    function SendMail(varTo, varFrom, varSubject, varBody)
    Dim objCDOMail, oMailConfig
    Set objCDOMail = CreateObject("CDO.Message")
    Set oMailConfig = Server.CreateObject("CDO.Configuration")
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
    = 1
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")
    = ""
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")
    = "xxxxxxxx"
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
    = "mail.thedomain.com"
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
    = 25
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")
    = 2
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
    = 60
    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl")
    = False
    oMailConfig.Fields.Update
    Set objCDOMail.Configuration = oMailConfig
    objCDOMail.From = varFrom
    objCDOMail.To = varTo
    objCDOMail.Subject = varSubject
    objCDOMail.HtmlBody = varBody
    objCDOMail.Send
    writeBackup()
    boolInquirySent = True
    Set oMailConfig = Nothing
    Set objCDOMail = Nothing
    end Function
    </code>

    thanks,
    --Chris Baker
    Chris Baker, Jan 2, 2006
    #1
    1. Advertising

  2. Chris Baker

    Patrice Guest

    What if you double click the form button ? Could it be that the user just
    clicks multiple times on the button ?

    --
    Patrice

    "Chris Baker" <> a écrit dans le message de
    news:...
    > This is a problem I have been troubleshooting for about 4-6 months. I
    > have an e-mail form on a client's public website that is mis-behaving.
    > It is written in ASP and uses a CDO.Message object. there is only one
    > call to the Send method. The problem occurs with and also without a
    > CDO.Configuration set to the Message.
    >
    > When I test the form from my computer, it acts normally, sending only
    > one message, and I receive only one message; however, when I send the
    > form from my client's office (his computer), 2 to 3 message are
    > received. The Message-IDs are different. The form writes unique
    > date/time information to a file each time a message is sent, so I know
    > that the code is being executed multiple times.
    >
    > This appears to be a problem with either his network or his computer,
    > but I don't know where to start. The code works fine, but I'll paste
    > it in anyway. Any thoughts would be appreciated!
    >
    > <code>
    > ' The values passed into this function should be validated already.
    > function SendMail(varTo, varFrom, varSubject, varBody)
    > Dim objCDOMail, oMailConfig
    > Set objCDOMail = CreateObject("CDO.Message")
    > Set oMailConfig = Server.CreateObject("CDO.Configuration")
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthe
    nticate")
    > = 1
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusern
    ame")
    > = ""
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassw
    ord")
    > = "xxxxxxxx"
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserve
    r")
    > = "mail.thedomain.com"
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserve
    rport")
    > = 25
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing
    ")
    > = 2
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconne
    ctiontimeout")
    > = 60
    >

    oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusess
    l")
    > = False
    > oMailConfig.Fields.Update
    > Set objCDOMail.Configuration = oMailConfig
    > objCDOMail.From = varFrom
    > objCDOMail.To = varTo
    > objCDOMail.Subject = varSubject
    > objCDOMail.HtmlBody = varBody
    > objCDOMail.Send
    > writeBackup()
    > boolInquirySent = True
    > Set oMailConfig = Nothing
    > Set objCDOMail = Nothing
    > end Function
    > </code>
    >
    > thanks,
    > --Chris Baker
    >
    Patrice, Jan 3, 2006
    #2
    1. Advertising

  3. Chris Baker

    Chris Baker Guest

    No. I was the one testing the form on his machine and I only clicked
    once. There is a client-side script that would prevent a second click.
    Chris Baker, Jan 3, 2006
    #3
  4. Chris Baker

    Patrice Guest

    Other options :
    - you could check the IIS log to see if you have a single request (the guy
    that have the problem could have disabled client scripting ?)

    You could also perhaps thave this guy describing exactly what he is doing as
    it seems specific to this guy and /or his machine...

    If you are 100% sure that the page is run once, you could likely add some
    kind of trace in a session variable to make sure you don't have some kind of
    logic error that makes your main code send several mails instead of one.

    Finally it could be perhaps that the same mail is send multiple times to the
    user (duplicate values in the To field or something like that ?).

    Good luck.

    --
    Patrice

    "Chris Baker" <> a écrit dans le message de
    news:...
    > No. I was the one testing the form on his machine and I only clicked
    > once. There is a client-side script that would prevent a second click.
    >
    Patrice, Jan 3, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    0
    Views:
    450
    John Saunders
    Aug 28, 2003
  2. Nehmo Sergheyev
    Replies:
    1
    Views:
    492
    Andrew Urquhart
    May 9, 2004
  3. Marcin Vorbrodt

    ::std sometimes needed, sometimes not

    Marcin Vorbrodt, Sep 16, 2003, in forum: C++
    Replies:
    24
    Views:
    746
    Jerry Coffin
    Sep 17, 2003
  4. Replies:
    1
    Views:
    491
    gkelly
    Nov 29, 2006
  5. Nikhil
    Replies:
    1
    Views:
    306
Loading...

Share This Page