SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,099
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Preventing CFMail from being send twice

    I have a simple shopping cart (Arrays and Structures). When someone have checked out the come on a age with their order information and a cfmail is send with that order information. I just found out that when I refresh the page the cfmail is send again (this time without order details since I also clear the structure on this page) Is there a way to prevent the cfmail from being send twise?

    Thank you all

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's no 100% sure way to prevent users from hitting refresh/back. But a few thoughts are

    - Add some validation so mails are only sent if there is information to process ie the cart is not empty.
    - After the mail is sent, and cart cleared, redirect users to a confirmation page. Then it won't matter if they refresh
    - Set a session variable that keeps track of order confirmations already sent. Then check it before sending an email.


Bookmarks

Posting Permissions

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