tigerdi
tigerdi

Reputation: 612

Selecting who receives automatic emails

I am trying to add a 'switch' feature to a company's website in the admin pages. Basically, this company sends out monthly reports to a number of subscribers. They use a database to store all the companies and subscribers info, and in the admin pages of their website they can add new companies and subscribers. When the subscription date is almost ended, then the subscribers get sent an automatic expiry reminder email. However, they want to be able to choose if the subscriber receives the expiry email. So on the admin page where they can edit the subscribers info, I want to put a switch which can set whether they receive it or not. I am trying to work out the best way to do this and which php pages need altering.

If you want to see some code from likely php pages (e.g. admin/index.php, etc) then let me know

Thanks

Upvotes: 0

Views: 52

Answers (1)

Fabio
Fabio

Reputation: 23500

actually your query is checking, as i supposed, for user that are going to expire in a certain date

"SELECT name, email, datetime_expire FROM subscriber WHERE datetime_expire = '".$expiry."'"

i think you should add an integer field to table subscriber like not_expiring with default set as 0. So you should change your query to this

"SELECT name, email, datetime_expire FROM subscriber WHERE datetime_expire = '".$expiry."' and not_expiring = '0'"

now you have to modify admin page and add a checkbox in the subscriber form to control this new database field and be able to set = 1 to clients you don't want to send email to. There must be another query among admin files where it updates subscribers table, you should change that too.

Upvotes: 1

Related Questions