ASP CDO mail only works when browser cache is cleared

Discussion in 'ASP General' started by Henry, Nov 6, 2007.

  1. Henry

    Henry Guest

    I have a simple form on a page in my website in which a user can enter
    an email address to be added to a mailing list.

    The following ASP script works the first time a user submits his or
    her email address. However, if the same user tries to submit another
    email, the browser hangs and times out. If the user clears the
    browser's cache, this script works fine. Could someone please explain
    this behaviour and how I can resolve it?

    Thanks!

    <%

    Set myMail=CreateObject("CDO.Message")
    myMail.Subject= "MAILING LIST ADDITION"
    myMail.From= Request.Form.Item(1)
    myMail.To=""
    myMail.TextBody= "Please add the following person to the mailing list:
    " & VbCrLf & VbCrLf & Request.Form.Item(1)
    myMail.Send
    set myMail=nothing
    Response.Redirect "http://www.domain.com"

    %>
     
    Henry, Nov 6, 2007
    #1
    1. Advertising

  2. "Henry" <> wrote in message
    news:...
    > I have a simple form on a page in my website in which a user can enter
    > an email address to be added to a mailing list.
    >
    > The following ASP script works the first time a user submits his or
    > her email address. However, if the same user tries to submit another
    > email, the browser hangs and times out. If the user clears the
    > browser's cache, this script works fine. Could someone please explain
    > this behaviour and how I can resolve it?
    >
    > Thanks!
    >
    > <%
    >
    > Set myMail=CreateObject("CDO.Message")
    > myMail.Subject= "MAILING LIST ADDITION"
    > myMail.From= Request.Form.Item(1)
    > myMail.To=""
    > myMail.TextBody= "Please add the following person to the mailing list:
    > " & VbCrLf & VbCrLf & Request.Form.Item(1)
    > myMail.Send
    > set myMail=nothing
    > Response.Redirect "http://www.domain.com"
    >
    > %>
    >


    I'm struggling to respond to this. Its somewhat incoherant. Are you sure
    the mail server you are using allows emails to apparently come from any
    random address?

    What does the form look like? I think we need to see that.
    I take it the page of code above is the action page of the form?
    You then redirect to the root of your site how does the user get to the form
    again?


    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Nov 8, 2007
    #2
    1. Advertising

  3. Henry

    Henry Guest

    The form is a simple text field on a "Contact Us" page of our website.
    The user enters an email address and clicks on a Send button. The
    scipt above is the action page which redirects the user back to the
    homepage. Sorry if it wasn't clear.

    To my knowledge, our server does not validate the email address. In my
    testing, I am able to successfully send an email via the form only
    once. And then I need to clear my browser cache for it to work again.

    I'm stumped!



    On Nov 8, 8:06 am, "Anthony Jones" <> wrote:
    > "Henry" <> wrote in message
    >
    > news:...
    >
    >
    >
    >
    >
    > > I have a simple form on a page in my website in which a user can enter
    > > an email address to be added to a mailing list.

    >
    > > The following ASP script works the first time a user submits his or
    > > her email address. However, if the same user tries to submit another
    > > email, the browser hangs and times out. If the user clears the
    > > browser's cache, this script works fine. Could someone please explain
    > > this behaviour and how I can resolve it?

    >
    > > Thanks!

    >
    > > <%

    >
    > > Set myMail=CreateObject("CDO.Message")
    > > myMail.Subject= "MAILING LIST ADDITION"
    > > myMail.From= Request.Form.Item(1)
    > > myMail.To=""
    > > myMail.TextBody= "Please add the following person to the mailing list:
    > > " & VbCrLf & VbCrLf & Request.Form.Item(1)
    > > myMail.Send
    > > set myMail=nothing
    > > Response.Redirect "http://www.domain.com"

    >
    > > %>

    >
    > I'm struggling to respond to this. Its somewhat incoherant. Are you sure
    > the mail server you are using allows emails to apparently come from any
    > random address?
    >
    > What does the form look like? I think we need to see that.
    > I take it the page of code above is the action page of the form?
    > You then redirect to the root of your site how does the user get to the form
    > again?
    >
    > --
    > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
    >
    > - Show quoted text -
     
    Henry, Nov 8, 2007
    #3
  4. "Henry" <> wrote in message
    news:...
    > The form is a simple text field on a "Contact Us" page of our website.
    > The user enters an email address and clicks on a Send button. The
    > scipt above is the action page which redirects the user back to the
    > homepage. Sorry if it wasn't clear.
    >
    > To my knowledge, our server does not validate the email address. In my
    > testing, I am able to successfully send an email via the form only
    > once. And then I need to clear my browser cache for it to work again.
    >
    > I'm stumped!
    >



    I'm not sure it such a good idea to do redirect in response to a post
    anyway.

    You might be better of sending some content back thanking the user for their
    interest etc blah.

    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Nov 8, 2007
    #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. Guest
    Replies:
    2
    Views:
    907
    dave wanta
    Jul 11, 2003
  2. Lance Safford
    Replies:
    0
    Views:
    406
    Lance Safford
    Apr 21, 2004
  3. BrainTop
    Replies:
    2
    Views:
    473
    Andreas
    Oct 17, 2006
  4. newbie
    Replies:
    2
    Views:
    250
    newbie
    Mar 3, 2004
  5. Replies:
    0
    Views:
    295
Loading...

Share This Page