CDO + Cookies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • surf_doggie

    CDO + Cookies

    I found that a number of my sites that send email using CDO failed
    withing the past 30 days. Consider the following. I know its not the
    best coding practice to open and close the connection so many times but
    Im curious why this would all of a sudden become an issue.

    1. Have a few large sites essentially all variables such as SMTP server
    are set using cookies so I can deploy multiple sites quickly.

    2. Within the site email appears to work correctly across all pages
    with 1 exception.

    3. The exception is below, Im wondering if it has to do with cookies
    having to be retrieved multiple times from the client machine

    --Call db run search loop data build array
    --Based on data in array call another search alter and finalize array
    --Do while <= uBound(myArray)
    --Call Email sub (from,to,sub,bo dy) ' Sub contains a request
    cookies for SMTP server.
    --Loop

    Doesnt matter if its 2 or 50 emails always fails when using
    request.cookies to set the SMTP in the sub. Works fine if I hard code
    the IP. This same sub is used multiple times throughout the website and
    works fine with cookies.

    Just curious why it needs might need to be hard coded in the loop. Has
    been running for about 6 months fine and have recently started noticing
    failures.

    Thanks,
    Earl

  • Mike Brind

    #2
    Re: CDO + Cookies


    surf_doggie wrote:[color=blue]
    > I found that a number of my sites that send email using CDO failed
    > withing the past 30 days. Consider the following. I know its not the
    > best coding practice to open and close the connection so many times but
    > Im curious why this would all of a sudden become an issue.
    >
    > 1. Have a few large sites essentially all variables such as SMTP server
    > are set using cookies so I can deploy multiple sites quickly.
    >
    > 2. Within the site email appears to work correctly across all pages
    > with 1 exception.
    >
    > 3. The exception is below, Im wondering if it has to do with cookies
    > having to be retrieved multiple times from the client machine
    >
    > --Call db run search loop data build array
    > --Based on data in array call another search alter and finalize array
    > --Do while <= uBound(myArray)
    > --Call Email sub (from,to,sub,bo dy) ' Sub contains a request
    > cookies for SMTP server.
    > --Loop
    >
    > Doesnt matter if its 2 or 50 emails always fails when using
    > request.cookies to set the SMTP in the sub. Works fine if I hard code
    > the IP. This same sub is used multiple times throughout the website and
    > works fine with cookies.[/color]

    I'm confused - it either works with cookies or it doesn't.
    [color=blue]
    >
    > Just curious why it needs might need to be hard coded in the loop. Has
    > been running for about 6 months fine and have recently started noticing
    > failures.[/color]

    You should never rely on storing info like this in cookies. People
    delete them, and your application depends on them. Application level
    information should be stored on the server - application
    variables/db/xml/etc...

    Have you checked to see if the cookie exists?

    --
    Mike Brind

    Comment

    • surf_doggie

      #3
      Re: CDO + Cookies

      > I'm confused - it either works with cookies or it doesn't.[color=blue]
      >[color=green]
      > >
      > > Just curious why it needs might need to be hard coded in the loop. Has
      > > been running for about 6 months fine and have recently started noticing
      > > failures.[/color]
      >
      > You should never rely on storing info like this in cookies. People
      > delete them, and your application depends on them. Application level
      > information should be stored on the server - application
      > variables/db/xml/etc...
      >
      > Have you checked to see if the cookie exists?
      >
      > --
      > Mike Brind[/color]

      Hey Mike Ive seen your posts I respect your opinion. Please let me
      clarify.

      1. I agree either it works or it doesnt. Thats why I dont understand.
      2. I only store the cookies on the client machine for the session when
      they close their browser the cookies are gone. These are not
      application level cookies just plain jane.

      consider this I have 100 webpages.
      <!-- some include file with cookies that expire when you close browser
      (mailhost included)>
      -->You have successfully logged in mailhost cookie is set.

      On about 50 of those pages if you want to send and individual
      email it calls
      --call SendMail(efrom, eto,subject,bod y)

      Works great for an email or 2.

      This may be where the rub is at Mike.

      Now every night I had scheduled a bat file to run and send multiple
      emails from a db. Failed mail couldnt be sent. At first I thought it
      was the permissions on the bat file or the permissions the AT Scheduler
      from windows was using but when I went to the url from my browser it
      died with smtp errors.

      I did trouble shooting for a month. When I hard coded the url it
      worked... O YES the connection for the cookies was in the loop file
      because I did a response.write to make sure the smtp server was correct
      in the loop file before I hard coded the IP of the SMTP server.

      Now Im just curious I have the solution, I agree either it works or it
      doesnt but why does it work sometimes? Is it because the loop cant grab
      the request.cookies off the client machine fast enough to keep up with
      what the CDO needs for the SMTP server config?

      These sites had been working up until about 1 to 3 months ago for a
      year and started cascade failing on the CDO. Once I figured to hard
      code the IP instead of cookies alls well.

      Thanks for your time.
      Earl

      Comment

      • surf_doggie

        #4
        Re: CDO + Cookies

        Sorry forgot to point out all of the emails are based off of the same
        function


        surf_doggie wrote:[color=blue][color=green]
        > > I'm confused - it either works with cookies or it doesn't.
        > >[color=darkred]
        > > >
        > > > Just curious why it needs might need to be hard coded in the loop. Has
        > > > been running for about 6 months fine and have recently started noticing
        > > > failures.[/color]
        > >
        > > You should never rely on storing info like this in cookies. People
        > > delete them, and your application depends on them. Application level
        > > information should be stored on the server - application
        > > variables/db/xml/etc...
        > >
        > > Have you checked to see if the cookie exists?
        > >
        > > --
        > > Mike Brind[/color]
        >
        > Hey Mike Ive seen your posts I respect your opinion. Please let me
        > clarify.
        >
        > 1. I agree either it works or it doesnt. Thats why I dont understand.
        > 2. I only store the cookies on the client machine for the session when
        > they close their browser the cookies are gone. These are not
        > application level cookies just plain jane.
        >
        > consider this I have 100 webpages.
        > <!-- some include file with cookies that expire when you close browser
        > (mailhost included)>
        > -->You have successfully logged in mailhost cookie is set.
        >
        > On about 50 of those pages if you want to send and individual
        > email it calls
        > --call SendMail(efrom, eto,subject,bod y)
        >
        > Works great for an email or 2.
        >
        > This may be where the rub is at Mike.
        >
        > Now every night I had scheduled a bat file to run and send multiple
        > emails from a db. Failed mail couldnt be sent. At first I thought it
        > was the permissions on the bat file or the permissions the AT Scheduler
        > from windows was using but when I went to the url from my browser it
        > died with smtp errors.
        >
        > I did trouble shooting for a month. When I hard coded the url it
        > worked... O YES the connection for the cookies was in the loop file
        > because I did a response.write to make sure the smtp server was correct
        > in the loop file before I hard coded the IP of the SMTP server.
        >
        > Now Im just curious I have the solution, I agree either it works or it
        > doesnt but why does it work sometimes? Is it because the loop cant grab
        > the request.cookies off the client machine fast enough to keep up with
        > what the CDO needs for the SMTP server config?
        >
        > These sites had been working up until about 1 to 3 months ago for a
        > year and started cascade failing on the CDO. Once I figured to hard
        > code the IP instead of cookies alls well.
        >
        > Thanks for your time.
        > Earl[/color]

        Comment

        • surf_doggie

          #5
          Re: CDO + Cookies

          Sorry would also like to point out its on multiple web servers in
          multiple networks.

          Mike if you want to see a demo Ill set up a webex

          Earl


          surf_doggie wrote:[color=blue][color=green]
          > > I'm confused - it either works with cookies or it doesn't.
          > >[color=darkred]
          > > >
          > > > Just curious why it needs might need to be hard coded in the loop. Has
          > > > been running for about 6 months fine and have recently started noticing
          > > > failures.[/color]
          > >
          > > You should never rely on storing info like this in cookies. People
          > > delete them, and your application depends on them. Application level
          > > information should be stored on the server - application
          > > variables/db/xml/etc...
          > >
          > > Have you checked to see if the cookie exists?
          > >
          > > --
          > > Mike Brind[/color]
          >
          > Hey Mike Ive seen your posts I respect your opinion. Please let me
          > clarify.
          >
          > 1. I agree either it works or it doesnt. Thats why I dont understand.
          > 2. I only store the cookies on the client machine for the session when
          > they close their browser the cookies are gone. These are not
          > application level cookies just plain jane.
          >
          > consider this I have 100 webpages.
          > <!-- some include file with cookies that expire when you close browser
          > (mailhost included)>
          > -->You have successfully logged in mailhost cookie is set.
          >
          > On about 50 of those pages if you want to send and individual
          > email it calls
          > --call SendMail(efrom, eto,subject,bod y)
          >
          > Works great for an email or 2.
          >
          > This may be where the rub is at Mike.
          >
          > Now every night I had scheduled a bat file to run and send multiple
          > emails from a db. Failed mail couldnt be sent. At first I thought it
          > was the permissions on the bat file or the permissions the AT Scheduler
          > from windows was using but when I went to the url from my browser it
          > died with smtp errors.
          >
          > I did trouble shooting for a month. When I hard coded the url it
          > worked... O YES the connection for the cookies was in the loop file
          > because I did a response.write to make sure the smtp server was correct
          > in the loop file before I hard coded the IP of the SMTP server.
          >
          > Now Im just curious I have the solution, I agree either it works or it
          > doesnt but why does it work sometimes? Is it because the loop cant grab
          > the request.cookies off the client machine fast enough to keep up with
          > what the CDO needs for the SMTP server config?
          >
          > These sites had been working up until about 1 to 3 months ago for a
          > year and started cascade failing on the CDO. Once I figured to hard
          > code the IP instead of cookies alls well.
          >
          > Thanks for your time.
          > Earl[/color]

          Comment

          Working...