public function errorEmail($e) { $email = new Mail_Postmark(); $email->subject('Inventory Site Error'); $email->addTo('*****@*****.**', 'Phil'); $body = ""; $body .= "There was an error:"; $body .= "File: " . $e->getFile() . "<br>"; $body .= "Line: " . $e->getLine() . "<br>"; $body .= "Message: " . $e->getMessage() . "<br>"; $body .= "Code: " . $e->getCode() . "<br>"; $body .= "Trace: " . $e->getTraceAsString() . "<br>"; $email->messageHtml($body); $email->send(); }
/** * overrides phpmailer::Send to send via the postmark api. * we'll pull the data we need from the phpmailer object * * @return (boolean) - whether or not sending via postmark api failed... **/ public function Send() { // make sure our constants have been defined... if (!defined('POSTMARKAPP_API_KEY') || !defined('POSTMARKAPP_MAIL_FROM_ADDRESS') || !defined('POSTMARKAPP_MAIL_FROM_NAME')) { // ...if nothing is defined, fall back to parent class Send method return parent::Send(); } // use PHP5 Reflection to get the private "$to" var out of // the phpmailer object... // http://www.php.net/manual/en/book.reflection.php $ref_class = new ReflectionClass('PHPMailer'); $ref_property = $ref_class->getProperty('to'); $ref_property->setAccessible(true); $phpmailers_to = $ref_property->getValue($this); // i miss teh nitrous $phpmailers_to = $phpmailers_to[0]; // remove empty elements in the array foreach ($phpmailers_to as $k => $v) { if ($v == "") { unset($phpmailers_to[$k]); } } // set a comma separated string of to addresses $postmark_to = implode(',', $phpmailers_to); // set up the other vars we need $postmark_subject = $this->Subject; $postmark_message_plain = $this->Body; // set up the postmark mail object $postmark_email = new Mail_Postmark(); $postmark_email->addTo($postmark_to); $postmark_email->subject($postmark_subject); $postmark_email->messagePlain($postmark_message_plain); // send it! try { $postmark_email->send(); return true; } catch (Exception $e) { $this->SetError($e->getMessage()); if ($this->exceptions) { throw $e; } return false; } }
$user_id = $db->insert('user', $data); $invitation_code = $user_id + 110000; $db->update('user', array('invitation_code' => $invitation_code), array('id' => $user_id)); $link = config('application.domain') . config('application.baseurl') . 'auth/' . $invitation_code; $text = "I invite you to collaborate on the " . $project['name'] . " project.\n\nClick on the following link to create an account for Clarify and open the project\n" . $link . "\n\nCheers\n" . user('name') . " & the Clarify team"; } else { $link = config('application.domain') . config('application.baseurl') . 'project/' . userid() . '/' . $project['slug']; $text = "I invite you to collaborate on the " . $project['name'] . " project.\n\nClick on the following link to open the project\n" . $link . "\n\nCheers\n" . user('name') . " & the Clarify team"; $user_id = $user['id']; } // add permission for this project $permission = array('created' => date('Y-m-d H:i:s'), 'creator' => userid(), 'project' => $project_id, 'user' => $user_id, 'permission' => 'EDIT'); $db->insert('project_permission', $permission); // send e-mail invitation to collaborator $email = new Mail_Postmark(); $email->addTo($_REQUEST['email'])->subject(user('name') . ' invites you to collaborate on the "' . $project['name'] . '" project')->messagePlain($text)->send(); $data['id'] = $id; echo json_encode($data); break; } else { header('The goggles, they do nawtink!', true, 400); echo 'Please enter a valid e-mail address. You know, with @ and all that stuff...'; break; } case API_COLLABORATOR_REMOVE: $id = intval($route[4]); $collaborator = $db->single("SELECT project FROM project_collaborator WHERE id = '" . $id . "' LIMIT 1"); $db->query("DELETE FROM project_collaborator WHERE id = '" . $id . "' AND creator = '" . userid() . "' LIMIT 1"); $db->query("DELETE FROM project_permission WHERE project = '" . $collaborator['project'] . "' LIMIT 1"); header('Content-Type: application/json'); $data = array();
// Create a new row of data and append it to the last row $item = ''; // Clear the contents of the $row variable to start a new row //$contents_checkins .= implode(",",$row); //$contents_checkins .="\n"; // write line of csv file } // end while $msg .= "Checkins Lifetime successful\n"; } else { $contents_checkins_lifetime .= "no checkins Lifetime,"; $msg .= "Checkins Today Lifetime (No Results)\n"; } error_log("message" . $msg, 0); $email = new Mail_Postmark(); $email->addTo($output_mail, 'Grind Tech Output'); $email->addCc($destination_mail); $email->subject('Daily Reports'); $email->messagePlain('Attached are the Daily Grind Reports' . "\n" . "User report:\n" . 'https://members.grindspaces.com/reports/' . $filename1 . "\nLifetime check-ins report:\n" . 'https://members.grindspaces.com/reports/' . $filename3); file_put_contents('/var/www/vhosts/members.grindspaces.com/content/reports/' . $filename1, $contents_users); file_put_contents('/var/www/vhosts/members.grindspaces.com/content/reports/' . $filename3, $contents_checkins_lifetime); //$email->addCustomAttachment($filename1, $contents_users, $mimeType1); echo "Total Size " . strlen($content_users . $contents_checkins . $contents_checkins_lifetime); $email->addCustomAttachment($filename2, $contents_checkins, $mimeType2); //$email->addCustomAttachment($filename3, $contents_checkins_lifetime, $mimeType3); $email->debug($debug); $email->send(); } catch (Exception $e) { $msg .= 'Error occurred: Reason: ' + $e->getMessage() . '<br/>'; error_log('Daily Reporting: Failed. Reason: ' . $e->getMessage(), 0); return false;