Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Email List

  1. #1
    Regular Coder
    Join Date
    May 2011
    Thanked 6 Times in 6 Posts

    Email List

    Need a little help on an email list script.

    I want to store email messages in a database, and then loop through any of those messages that haven't been sent to every single member listed in my members list. I'm on 1&1 and they only permit 55 emails sent every 5 minutes. So I have to do this with a Cron Job.

    How would I make it so the script pulls one email message at a time, sends the email to each member in the members database, then marks the email as sent in the message database, and resets the "sent" column in the members database back to 0.

    Maybe I should include the most recent message id sent for each members row?

    Here's my database structure:

    | id | name | email | sent |
    | 1 | Test | Test@example.com | 0 |

    | id | message | email_sent |
    | 1 | Test Message | 0 |
    | 2 | Test Message 2 | 0 |
    PHP Code:
    $mailing_list_result=mysqli_query($mailing_list_db"SELECT `name`, `email` 
    FROM `mailing_list` WHERE `sent`=0 LIMIT 0, 55"


    `mailing_list_mesages` SET `email_sent`=1 WHERE `email_id`=?"

    $reset_result=mysqli_query($mailing_list_db"UPDATE `mailing_list` SET 
    //Database Pull for Email message
    //Mail PHP

    Last edited by HDRebel88; 01-21-2013 at 08:28 AM.

  2. #2
    Supreme Master coder!
    Join Date
    Jun 2003
    Cottage Grove, Minnesota
    Thanked 1,167 Times in 1,158 Posts
    How often do you have to email 'everyone' in the list? I'm just curious.
    Once per day, once per week?

    You also have the problem where if you have more than 55 people, you need to
    know when ALL of them have received the email message. So it looks like you
    might have multiple email messages to send. I'm assuming those email messages
    need to be sent in order of how they appear?

    Doing the limit of 55 will result in only 55 names, and you'll send out a message
    to them ... but the next time it runs, you'll need to know which of the remaining
    people didn't get the message, and WHICH message are you working on? It looks
    like you could have like 10 messages in the queue waiting to be sent?

    How many email addresses do you think you'll have now or in two years from now?
    Will you have hundreds, thousands?

    I think the answer to your problem will depend on how often email messages are
    sent, and how many recipients you have.

    Last edited by mlseim; 01-21-2013 at 01:13 PM.

  3. #3
    Regular Coder
    Join Date
    May 2011
    Thanked 6 Times in 6 Posts
    Yeah, we'd be looking at 10k+ addresses... I'm just going to be using a previously developed script. ListMessenger; just seems easier that way.


Posting Permissions

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