function to control speed of e-mails being sent.

Discussion in 'PHP' started by mbaldwin, Nov 6, 2008.

  1. #1
    Hi,
    Because a lot of hosts have limits on how many e-mails can be sent at a time, example my host says no more than 500 per hour, and no faster than 1 per 6 seconds.

    i want to right a function that can get the member's e-mails from the MySQL table, and send them according to the limits set by the host, which I will put in variables so i can change them later if i switch hosts.

    i will be using the standard php mailto function, if possible. Currently my host does not allow sending via smtp scripts, not sure how they know the difference between outlook sending from my desktop, and smtp script on my site sending them, but oh well.

    can anyone point me in the right direction? Not asking you to write the script, although if you already have one, I would like to look at it to modify it for my needs.
    Using php 5.2.6
    Thanks,
    Michael
     
    mbaldwin, Nov 6, 2008 IP
  2. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    dev_SeeInside, Nov 6, 2008 IP
  3. mbaldwin

    mbaldwin Active Member

    Messages:
    215
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    95
    #3
    Thanks, that did help. There were no code examples in the php.net area for what I was looking for, but I got something pieced together that might work.

    I can post it here if anyone else is interested.
    Thanks,
    Michael
     
    mbaldwin, Nov 6, 2008 IP
  4. sandeep_india

    sandeep_india Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Here you can use sleep(seconds) function. which stop the execution for the given seconds.
    but if you are sending more emails then u have to increase the execution timeout.
    Use:
    ini_set('max_execution_time', 1200);
    ini_set("memory_limit","50M");

    put this code in very first line of script file. this code will continue your script to 1200 seconds. pls change the seconds to your require time limit.

    Hope it will solve your prob. cheers
     
    sandeep_india, Nov 6, 2008 IP
  5. mbaldwin

    mbaldwin Active Member

    Messages:
    215
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    95
    #5
    sandeep_india
    thanks for the tip, I will keep that in mind if i am ever sending that many message at a time, but I hope if i am sending out that many, I am on at least a VPS, if not a dedicated box.

    Thanks,
    Michael
     
    mbaldwin, Nov 7, 2008 IP