Jump to content

Auto Send Email


jj20051

Recommended Posts

Ok I Have A Database With 20 Users In It. They Each Pay Once A Month On A Specific Day. The Day Of The Month Is Stored As A Single Number. For Instance 13 or 21 . I Have Already Setup A Cron Job To Run The Script Daily. How Do I Have The Script Check The Database To See If Anyone Owes On That Day To Email That User. Certain Days Have Multiple Users. The Email Portion I Already Understand, It's The PHP To Check and Email People. Also If No User Owes On A Specific Day It Won't Send Any Emails ( If or else statement i know )

Link to comment
https://forums.phpfreaks.com/topic/114529-auto-send-email/
Share on other sites

My Database Name Is members The Table they Are Stored In Is Called users. The Columns ( I Think They Are Called Columns ) Are: name , email , date and amount.

 

The Date Is A Single Number Representing The Day Of The Month For Instance 13 Means That They Owe On The 13th Day Of Each Month.

 

The Amount Is In The Format 0.00 such as 1.99 or 12.99

Link to comment
https://forums.phpfreaks.com/topic/114529-auto-send-email/#findComment-588938
Share on other sites

<?php

$day=date("j");

$sql="SELECT * FROM `table` WHERE `day`={$day}";

$query=mysql_query($sql);

while ($req=mysql_fetch_array($query)) {

  mail($req['UserEmail'], "You must pay for protection.", "You haven't paid for protection. You have one day to pay or god may strike down your building.");

}

?>

Link to comment
https://forums.phpfreaks.com/topic/114529-auto-send-email/#findComment-588942
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.