Custom Newsletter Script

Hi there,

I am developing a “Parenting” website and I’m tasked with creating or finding a custom newsletter script, which I need help with.

Here are the specs…

I have 40 Articles, written for each week that a woman is expecting a baby. I need to allow women to sign up to receive these newsletters.

It sounds simple enough but here is where I’m stuck…

I need to be able to capture how many weeks pregnant somebody is when they sign up to the newsletters and ONLY send them the newsletter relevant to them. So if somebody who is 6 weeks pregnant signs up, they need to start receiving their weekly newsletters from “week 6” as there is no need for them to receive the first 5.

The articles are all pre-written and stored in a MySQL database with relevant ID’s… eg, Week 1 will be email ID 1, Week 40 will be email id 40 (this will be the one that stops the cycle.) So basically, I want a PHP Script that will do the following:

  1. Form input to capture personal details (name, email address)
  2. Form input - How many weeks pregnant are you now?
  3. Send their first email immediately after subscription for the week relevant to their answer to the above question.
  4. Continue to send the remaining emails, 1 each week until email ID #40 has been sent then stop.

Does anybody know how this can be achieved or whether there is a similar newsletter script out there that I can use to fulfil this purpose. I realise it’s not exactly a straight forward newsletter but any advice offered will be greatly received.

PHPList is a good newsletter manager. You would only need to update each week who to send each of the 40 newsletters to.

Thanks for your reply but I’m looking for something that will run automatically, like a cron job - I’ll keep researching :slight_smile:

Here’s some further clarification on how I want this to work…

I will have 40 tables in a MySQL Database. Each table will contain the following data:

Name
Email Address
Newsletter

When a user signs up to the newsletter, they will choose from a drop down menu how many weeks pregnant they are… If they choose 6 weeks, they will put into Table #6, etc…

Each week I will log on to my site, click the “button” to run my PHP Script. That script will do the following:

Access Table #40, send the content in the “Newsletter” field to all of the “Email Addresses” then empty the table.

Access Table #39, send the content in the “Newsletter” field to all of the “Email Addresses”, copy data from “Name” and “Email Address” fields and move it to Table #40 then empty the table.

Access Table #38, send the content in the “Newsletter” field to all of the “Email Addresses”, copy data from “Name” and “Email Address” fields and move it to Table #39 then empty the table.

And so on and so on… I think you get the idea :slight_smile:

I know the SQL Queries to copy from one table to another then empty the source table. I just don’t know how to put this into a PHP script so that it will send the e-mail and process the 40 different SQL Queries at the click of a button.

I’d even be happy with two scripts… One script to send the emails and then another to “progress” the SQL Data so that it moves everyone forward.

So Script 1 (Send Email):

Access all 40 tables and send the “Newsletter” content to all of the “Email Addresses” - End Script & Prompt to run Script 2.

Script 2 (Progress Subsribers):

Access Table #40 and empty it.
Access Table #39 and move “Name” and “Email” fields over to table #40
Access Table #38 and move “Name” and “Email” fields over to table #39

etc etc…

I believe PHPlist offers this as a feature or option. Jobs can also be queued and sent at anytime in the future.