Automatic emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mlevit
    New Member
    • Jun 2007
    • 30

    Automatic emails

    Hey guys,

    I don't have an issue right now but I am starting a trading website similar to eBay and I cannot get my head around one thing. How do you code so that emails are sent out automatically without any user input/events.

    Like when an eBay auction ends, you the seller would receive an email telling you that it ended. Or if say you have a yearly subscription to something and it's about to end, an email would be sent out telling you that the subscription is about to end.

    These emails are sent out automatically, but I don't know how they work. Is it scripts on the server somewhere or in the database?

    Please let me know.

    Thanks
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You'll need SOME action to send out emails. This could be the result of a regularly initiated job (like a cron job) or the result of another action such as the closing of a bid (which in itself requires some action).

    Ronald

    Comment

    • mlevit
      New Member
      • Jun 2007
      • 30

      #3
      Originally posted by ronverdonk
      You'll need SOME action to send out emails. This could be the result of a regularly initiated job (like a cron job) or the result of another action such as the closing of a bid (which in itself requires some action).

      Ronald
      But what happens if the auction closes without any bids on it. Then there has been no user input and therefore no action has been initiated by the user. And with cron jobs, that would require you to set the date/time for the actions to take place, but again in terms of the auction example, auctions end at any time and straight after they have ended the emails are sent out by the website.

      I just can't wrap my mind around this.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by mlevit
        But what happens if the auction closes without any bids on it. Then there has been no user input and therefore no action has been initiated by the user. And with cron jobs, that would require you to set the date/time for the actions to take place, but again in terms of the auction example, auctions end at any time and straight after they have ended the emails are sent out by the website.

        I just can't wrap my mind around this.
        Surely there must be some timer in place? When this timer reaches the end of it's run it'd initiate some other action to say that the auction has ended and do the relevant actions.

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          Originally posted by mlevit
          But what happens if the auction closes without any bids on it. Then there has been no user input and therefore no action has been initiated by the user. And with cron jobs, that would require you to set the date/time for the actions to take place, but again in terms of the auction example, auctions end at any time and straight after they have ended the emails are sent out by the website.

          I just can't wrap my mind around this.
          Nothing can ever happen without some sort of a action taking place.
          In your eBay scenario, I would guess they have set up a cron-job that fires up every minute or so and checks if any auctions need to be closed.

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            Originally posted by markusn00b
            Surely there must be some timer in place? When this timer reaches the end of it's run it'd initiate some other action to say that the auction has ended and do the relevant actions.
            Wouldn't you need it running the timer on an open page on the server or something?

            What about making the auction so that once the time is <0, ie bidding is over, the person is stopped from bidding, and then just have a cron job which runs every 10mins to check the database for items that have expired and send an email to the owner?
            You will need another variable 'email_sent' which will be 0 when bidding, and once the cron job has sent the email it changes it to 1. That way you won't spam someone every 10 mins!

            Comment

            Working...