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... Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/ Share on other sites More sharing options...
BlueSkyIS Posted May 8, 2008 Share Posted May 8, 2008 what have you got so far? Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-536381 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? Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540449 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 Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540451 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 Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540458 Share on other sites More sharing options...
DarkWater Posted May 13, 2008 Share Posted May 13, 2008 Which is basically a cron. Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540463 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 Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540483 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> Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540484 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?? Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540491 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. Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540493 Share on other sites More sharing options...
abs0lut Posted May 14, 2008 Author Share Posted May 14, 2008 dateformat: YYYY-MM-DD Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-540630 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... Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-541507 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 = '[email protected]'; $subject = 'The date!'; $message = $mess; $headers = "From: [email protected]\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!"; } } ?> Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-541517 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 = '[email protected]'; $subject = 'The date!'; $message = $mess; $headers = "From: [email protected]\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?? Link to comment https://forums.phpfreaks.com/topic/104783-email-notification-everyday/#findComment-542507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.