abs0lut Posted May 8, 2008 Share Posted May 8, 2008 the computer will subtract todays date from the date that is stored in database then, the computer will send an email everyday before the date that is stored in database.. example its only 3 days and the poll will be closed please help... Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 8, 2008 Share Posted May 8, 2008 what have you got so far? Quote Link to comment Share on other sites More sharing options...
abs0lut Posted May 13, 2008 Author Share Posted May 13, 2008 is it possible to send emails everyday without using cron jobs? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 13, 2008 Share Posted May 13, 2008 No. You'd need to access the page once a day to do it. EDIT: And that wouldn't be automated, now would it? =P Quote Link to comment Share on other sites More sharing options...
Fadion Posted May 13, 2008 Share Posted May 13, 2008 Actually it is possible. U can use Scheduled Tasks on windows :PP Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 13, 2008 Share Posted May 13, 2008 Which is basically a cron. Quote Link to comment Share on other sites More sharing options...
Fadion Posted May 14, 2008 Share Posted May 14, 2008 Which is basically a cron. I know mate, i was just being sarcastic Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 14, 2008 Share Posted May 14, 2008 If only internet sarcasm was more easily detectable. =P </sarcasm> Quote Link to comment Share on other sites More sharing options...
abs0lut Posted May 14, 2008 Author Share Posted May 14, 2008 I need to find the number of days between 2 dates. could you please help me?? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 14, 2008 Share Posted May 14, 2008 How are the dates formatted? Give us some examples. Quote Link to comment Share on other sites More sharing options...
abs0lut Posted May 14, 2008 Author Share Posted May 14, 2008 dateformat: YYYY-MM-DD Quote Link to comment Share on other sites More sharing options...
abs0lut Posted May 15, 2008 Author Share Posted May 15, 2008 <?php function diffDates($date1,$date2) { $date1_array = explode("-",$date1); $date2_array = explode("-",$date2); $tstamp1 = mktime(0,0,0,$date1_array[1],$date1_array[2],$date1_array[0]); $tstamp2 = mktime(0,0,0,$date2_array[1],$date2_array[2],$date2_array[0]); $diff= ($tstamp2 - $tstamp1)/86400; return round($diff,0); } diffDates($date01,$date02); ?> the computer will send an email containing the computed difference everyday before the date that is stored in database.. the computer will not send if the date today is equal or greater than the date that is stored in database.. could you please help me... Quote Link to comment Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 HERE A QUICK EXAMPLE TO SEND A EMAIL EVERYDAY VIA DATE... <?php $a=array("20080514"); // DATABASE DATE........ $new_date = date("Ymd"); // TODAYS DATE VIA THE DATE FUNCTION.. $old_date=implode(' ',$a); if($new_date > $old_date){ $mess="The date of $old_date is less then new date $new_date so each day ill get an email!"; $to = 'bob@barnyard.com'; $subject = 'The date!'; $message = $mess; $headers = "From: server@barnyard.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ echo"Mail was sent!"; }else{ echo "Mail was not sent!"; } } ?> Quote Link to comment Share on other sites More sharing options...
abs0lut Posted May 16, 2008 Author Share Posted May 16, 2008 HERE A QUICK EXAMPLE TO SEND A EMAIL EVERYDAY VIA DATE... <?php $a=array("20080514"); // DATABASE DATE........ $new_date = date("Ymd"); // TODAYS DATE VIA THE DATE FUNCTION.. $old_date=implode(' ',$a); if($new_date > $old_date){ $mess="The date of $old_date is less then new date $new_date so each day ill get an email!"; $to = 'bob@barnyard.com'; $subject = 'The date!'; $message = $mess; $headers = "From: server@barnyard.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ echo"Mail was sent!"; }else{ echo "Mail was not sent!"; } } ?> this will send an email everyday without using cron jobs?? or do I need to run manually the file?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.