function createAndSendEmail_ReminderTimeAway($personRecord, $time) { // get person's data $name = $personRecord[0]["name"]; $email = $personRecord[0]["email"]; $key = $personRecord[0]["key"]; if ($time == "2weeksp" || $time == "2weekspfar" || $time == "tomorrowp") { $link = "www.t9hacks.org/signupPages/signup-participant2.php?key={$key}"; } else { if ($time == "2weeksm" || $time == "tomorrowm") { $link = "www.t9hacks.org/signupPages/signup-mentor2.php?key={$key}"; } } // create send to $sendTo = $name . " <{$email}>"; // create subject $subject = ""; if ($time == "2weeksp" || $time == "2weeksm") { $subject = "Reminder for T9Hacks"; } else { if ($time == "2weekspfar") { $subject = "Updates for T9Hacks - RESPONSE REQUIRED"; } else { if ($time == "tomorrowm" || $time == "tomorrowp") { $subject = "Reminder for T9Hacks Spring 2016"; } } } // create email message $styles = EmailHelperClass::getEmailStyles(); $linkStyles = $styles['linkStyles']; if ($time == "2weeksp" || $time == "2weekspfar") { $message = file_get_contents("emails/2weeksparticipant.php"); } else { if ($time == "2weeksm") { $message = file_get_contents("emails/2weeksmentor.php"); } else { if ($time == "tomorrowp") { $message = file_get_contents("emails/tomorrowparticipant.php"); } else { if ($time == "tomorrowm") { $message = file_get_contents("emails/tomorrowmentor.php"); } } } } // replace variables $message = str_replace("[[NAME]]", $name, $message); $message = str_replace("[[LINK]]", $link, $message); $message = str_replace("[[LINKSTYLES]]", $linkStyles, $message); $message = str_replace("[[HEADER]]", EmailHelperClass::createEmailHeader(), $message); $message = str_replace("[[FOOTER]]", EmailHelperClass::createEmailFooter($name), $message); $event = new DateTime('2016-02-20'); $today = new DateTime(date("Y-m-d")); $interval = $today->diff($event); $daysAway = $interval->format('%d'); $message = str_replace("[[TIME]]", $daysAway . " days ", $message); //echo $daysAway; if ($time == "2weeksp" || $time == "2weekspfar") { $dist = ""; if ($time == "2weekspfar") { $dist = "\r\n\t\t\t\t\t<li style='padding: 0 0 20px;'>\r\n\t\t\t\t\t\t<p style='margin: 0; padding: 0;'>\r\n\t\t\t\t\t\t\t<b style='color: #553377;font-size: 1.2em;'>CONFIRM THAT YOU ARE COMING!</b> We noticed\r\n\t\t\t\t\t\t\tthat you are traveling to T9Hacks from out of state. We require confirmation from participants\r\n\t\t\t\t\t\t\tthat are traveling from a distance. Keep in mind that we we cannot cover or reimburse any \r\n\t\t\t\t\t\t\ttravel costs. Please confirm with Brittany (brittany.kos@colorado.edu) if you are attending or \r\n\t\t\t\t\t\t\tnot. If we do not hear from you by the end of Monday, February 8, 2016, we will remove your \r\n\t\t\t\t\t\t\tregistration.\r\n\t\t\t\t\t\t</p>\r\n\t\t\t\t\t</li>\r\n\t\t\t\t\t\t"; } $message = str_replace("[[DISTANCE_REQ]]", $dist, $message); } //echo $message; die(); // create headers $headers = EmailHelperClass::createHeaders($subject, $sendTo); // send email $emailResult = mail($sendTo, $subject, $message, $headers); // return result return $emailResult; }
<?php include_once '../EmailHelperClass.php'; $styles = EmailHelperClass::getEmailStyles(); $linkStyles = $styles['linkStyles']; echo EmailHelperClass::createEmailHeader(); ?> <tr><td style='padding: 20px 20px 0 20px;'> <h2>Hi [[NAME]],</h2> <p>This is your last application notice for T9Hacks Spring 2016!</p> </td></tr> <tr><td style='padding: 0 20px;'> <hr/> </td></tr> <tr><td style='padding: 0 20px;'> <p> Your friend started your application for <a href='www.t9hacks.org' style='<?php echo $linkStyles; ?> ' target='_blank' wotsearchprocessed='true'>T9Hacks</a>. </p> <p> T9Hacks is a 24 hour women's hackathon promoting gender diversity in technology. It is held at the University of Colorado Boulder's ATLAS Institute on Feb 20-21. T9Hacks brings students together for a weekend of creativity, building, and hacking. </p> <p><b>