/** * Generate a password reset token and email a link to the user. * * @return string Standard JSON envelope */ public function passwordRequest() { if (!isset($_POST['email'])) { return $this->error('No email address provided.', false); } $email = $_POST['email']; if ($email == $this->config->user->email) { $token = md5(rand(10000, 100000)); $tokenUrl = sprintf('%s://%s/manage/password/reset/%s', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST'], $token); $this->user->setAttribute('passwordToken', $token); $templateObj = getTemplate(); $template = sprintf('%s/email/password-reset.php', $this->config->paths->templates); $body = $this->template->get($template, array('tokenUrl' => $tokenUrl)); $emailer = new Emailer(); $emailer->setRecipients(array($this->config->user->email)); $emailer->setSubject('Trovebox password reset request'); $emailer->setBody($body); $result = $emailer->send(); if ($result > 0) { return $this->success('An email was sent to reset the password.', true); } else { $this->logger->info('Unable to send email. Confirm that your email settings are correct and the email addresses are valid.'); return $this->error('We were unable to send a password reset email.', false); } } return $this->error('The email address provided does not match the registered email for this site.', false); }
function sendEmail($send = true) { $emailer = new Emailer(); $message = $this->getString(); $emailer->setMessage($message); $emailer->setSubject($this->subject); $emailer->setSender("*****@*****.**"); $emailer->addRecipients($this->recipient); $emailer->addRecipients($this->bccrecipients, 1, "bcc"); $emailer->addRecipients($this->ccrecipients, 1, "cc"); if ($send) { $emailer->send(); } else { $emailString = $emailer->getString(); print $emailString; } }
$invoice['show_shipping'] = $invoice['shipping'] > 0 ? true : false; $invoice['terms'] = $invoice['terms'] ? $invoice['terms'] : ($client['def_terms'] ? $client['def_terms'] : ($admin['def_terms'] ? $admin['def_terms'] : $lang['terms'])); $invoice['comments'] = $invoice['comments'] ? $invoice['comments'] : ($client['def_comments'] ? $client['def_comments'] : ($admin['def_comments'] ? $admin['def_comments'] : '')); $invoice['due_date'] = date($SYSTEM["regional"]["invoicedate"], $invoice['due_date']); $invoice['issue_date'] = date($SYSTEM["regional"]["invoicedate"], $invoice['issue_date']); $invoice['calc_tax'] = currency_format($invoice['calc_tax']); $invoice['calc_tax2'] = currency_format($invoice['calc_tax2']); $invoice['shipping'] = currency_format($invoice['shipping']); $invoice['cost'] = currency_format($invoice['cost']); $invoice['total'] = currency_format($invoice['total']); $emailSendID = $ISL->addEmailSend($invoice['clientid'], $invoiceID, $client['email'], 1); $e = new Emailer(); $e->setMainFile('forms/email_invoice.tpl'); $e->setFrom($SYSTEM['email']['from']); $e->setFromName($SYSTEM['email']['fromName']); $e->setSubject($lang['eml_subj_invoice']); $e->set('SYSTEM', $SYSTEM); $e->set('invoice', $invoice); $e->set('client', $client); $e->set('admin', $admin); $ispayed = strtolower($invoice['curr_status']) == 'fully paid' ? true : false; $e->set('ispayed', $ispayed); $e->fetchMessage(); $e->appendMessage('<img src="' . HTTP_ROOT . 'isop.php?sid=' . $emailSendID . '" width="1" height="1">'); $e->setRecipient($client['email']); $e->setPriority('High'); $result = $e->send(); unset($e); $result = $result ? 'Successful' : 'Failed'; if ($invoice['curr_status'] == 'unsent') { $ISL->UpdateInvoiceStatus($invoiceID, 'pending');
$objUrls->parseRequest($params['_urlrequest']); if (!empty($objUrls->requestParams)) { $params = array_merge($params, $objUrls->requestParams); } // start up try { $objSettings->loadSettings(); $objDispatcher->setDirectory('frontend'); $objDispatcher->setController($objUrls->requestController); $objDispatcher->setAction($objUrls->requestAction); $objDispatcher->setParams($params); $objDispatcher->dispatch(); } catch (Exception $e) { $objEmail = new Emailer(); $objEmail->addTO(ERROR_EMAIL); $objEmail->setFrom(ERROR_EMAIL); $objEmail->setSubject('FATAL ERROR | Exception thrown on ' . URL); $objEmail->setBody('Fatal Exception! ' . $e->getMessage() . print_r($params, true)); //$objEmail->sendMail(); die('Error<br/>' . $e->getMessage() . '<br/><a href="http://' . URL . '">' . PRODUCT_NAME . '</a>'); } // time to clean up $dbQueries = $objDatabase->getNumbQueries(); $objDatabase->disconnect(); //end timer $endTime = microtime(true); // calc render details $totalSeconds = number_format($endTime - $startTime, 3); $totalMemory = number_format(memory_get_peak_usage() / 1024, 2); // speed / queries / memory report //echo "\r\n".'<!--'."\r\n".'Took '.$totalSeconds.' seconds, '.$dbQueries.' database queries, and '.$totalMemory.'KB of memory'."\r\n".'-->';
public function uploadNotify($token) { $shareTokenObj = new ShareToken(); $tokenArr = $shareTokenObj->get($token); if (empty($tokenArr) || $tokenArr['type'] != 'upload') { return $this->forbidden('No permissions with the passed in token', false); } $albumId = $tokenArr['data']; $albumResp = $this->api->invoke(sprintf('/album/%s/view.json', $albumId), EpiRoute::httpGet, array('_GET' => array('token' => $token))); if ($albumResp['code'] !== 200) { return $this->error('Could not get album details', false); } $uploader = $count = null; if (isset($_POST['uploader'])) { $uploader = $_POST['uploader']; } if (isset($_POST['count'])) { $count = $_POST['count']; } $utilityObj = new Utility(); $albumName = $albumResp['result']['name']; $albumUrl = sprintf('%s://%s/photos/album-%s/token-%s/list??sortBy=dateUploaded,desc', $utilityObj->getProtocol(false), $utilityObj->getHost(false), $albumId, $token); $tokenOwner = $tokenArr['actor']; $emailer = new Emailer(); $emailer->setRecipients(array($tokenOwner)); if (!empty($albumName)) { $emailer->setSubject(sprintf('Photos uploaded to %s', $albumName)); } else { $emailer->setSubject('New photos were uploaded for you'); } $markup = $this->theme->get('partials/upload-notify.php', array('albumId' => $albumId, 'albumName' => $albumName, 'albumUrl' => $albumUrl, 'uploader' => $uploader, 'count' => $count)); $emailer->setBody($markup); $res = $emailer->send($markup); return $this->success('Email probably sent', true); }
$tpl =& new TemplateSystem(); if (isset($_POST['btnSubmit'])) { if ($_POST['email'] != '') { $method = 'email'; $value = $_POST['email']; } elseif ($_POST['username'] != '') { $method = 'username'; $value = $_POST['username']; } $client = $ISL->recoverPassword($method, $value); if (is_array($client)) { $e = new Emailer(); $e->setMainFile('forms/email_forgotpass.tpl'); $e->setFrom($SYSTEM['email']['from']); $e->setFromName($SYSTEM['email']['fromName']); $e->setSubject($lang['eml_subj_forgotpass']); $e->set('client', $client); $e->fetchMessage(); $e->setRecipient($client['email']); $e->setPriority('High'); $e->send(); unset($e); } else { trigger_error($lang['no_client_found'], E_USER_WARNING); die; } $tpl->set('tbody', 'forgotpass_sent.tpl'); $tpl->set('message', sprintf($lang['password_sent'], 'index.php')); } else { $tpl->set('tbody', 'forgotpass.tpl'); }
function actionLogin($params = '') { if (!empty($params['email']) && !empty($params['password'])) { if ($this->objAuthentication->login($params['email'], $params['password'])) { //no errors, continue to home /*$objDispatcher = new Dispatcher; $objDispatcher->setController('Forum'); $objDispatcher->setAction('Index'); $objDispatcher->setParams($params); $objDispatcher->dispatch();*/ $this->actionIndex($params); } else { $this->view->assign('errorMsg', 'Unable to login, try again.'); $this->view->assign('content', $this->view->fetch('tpl/community/login.tpl')); $this->finish(); } } else { if (!empty($params['createAccount']) && $params['createAccount'] == 1) { $errorMessages = array(); $objValidator = new Validator(); $objValidator->reset(); $objValidator->validateEmail($params['create_email']); $objValidator->validatePassword($params['create_password']); $objValidator->passwordsMatch($params['create_password'], $params['create_password2']); $objValidator->validateName($params['create_displayName']); if ($objValidator->hasError || empty($params['create_terms'])) { $error = $objValidator->getError(); if (empty($params['create_terms'])) { $error[] = 'You must agree to the Terms of Use to make an account'; } $this->view->assign('errorMessages', $error); $this->view->assign('created', false); } else { $userData = array(); $userData['email'] = $params['create_email']; $userData['password'] = $params['create_password']; $userData['displayName'] = $params['create_displayName']; $userModel = new UserModel(); $created = $userModel->createUser($userData); if (!empty($created)) { $this->view->assign('created', true); $objEmail = new Emailer(); $objEmail->setFrom(CONTACT_EMAIL); $objEmail->setSubject('Retail Roar Community account created'); $objEmail->addTO($userData['email']); $objEmail->setBody($this->view->fetch('emails/communitysignup.tpl'), true); $sent = $objEmail->sendMail(); } else { $this->view->assign('created', false); $this->view->assign('errorMessages', $userModel->errorMsg); } $this->view->assign('submitted', true); } $this->view->assign('content', $this->view->fetch('tpl/community/login.tpl')); $this->finish(); } else { if ($this->objAuthentication->loggedIn()) { $this->view->assign('content', 'Already logged in.'); $this->finish(); } else { $this->view->assign('content', $this->view->fetch('tpl/community/login.tpl')); $this->finish(); } } } }
$mail->bodyAdd("Thank you for registering with Fast Food Jobs but as we take your privacy seriously, we just wanted to check you did register with our site."); $mail->bodyAdd("In order to gain access to all of the web site functionality please click on here: {$url}"); $mail->bodyAdd(""); $mail->bodyAdd("If you should not have received this e-mail, please click on the e-mail link below and just put \"remove\" in the heading and we will remove your details from our system."); $mail->bodyAdd(""); $mail->bodyAdd("Regards"); $mail->bodyAdd(""); $mail->bodyAdd("The Fast Food Jobs Team"); $mail->bodyAdd(""); $mail->bodyAdd("Tel: 0845 644 8252"); $mail->bodyAdd("*****@*****.**"); $mail->send(); $adminMail = new Emailer(); $adminMail->setTo($configuration["adminEmail"]); $adminMail->setFrom($configuration["fromEmail"]); $adminMail->setSubject("New Sign up"); $adminMail->bodyAdd("Dear admin,"); $adminMail->bodyAdd("Just to let you know that new member"); $adminMail->bodyAdd("Name: " . $first_name . " " . $last_name); $adminMail->bodyAdd("Emai: {$email}"); $adminMail->bodyAdd("Role: {$role}"); $adminMail->bodyAdd("has just joined Fast Foods."); $adminMail->send(); header("Location: register_thankyou.php"); exit; } } $errorText = "<ul>" . $errorText . "</ul>"; } require "top.php"; ?>
$text = $_POST["text"]; $link = $_POST["link"]; if (($result = validate($heading, "", 20)) !== true) { $errorText .= "<li>The heading is {$result}"; } if (($result = validate($text, "", 50)) !== true) { $errorText .= "<li>The main text is {$result}"; } if (($result = validate($link, "", 255)) !== true) { $errorText .= "<li>The URL link is {$result}"; } if ($errorText == "") { $mail = new Emailer(); $mail->setTo($configuration["adminEmail"]); $mail->setFrom("*****@*****.**"); $mail->setSubject("Classified Advert"); $mail->bodyAdd("NEW CLASSIFIED ADVERT"); $mail->bodyAdd(""); $mail->bodyAdd("User: "******"Heading: {$heading}"); $mail->bodyAdd("Text: {$text}"); $mail->bodyAdd("URL: {$link}"); $mail->bodyAdd(""); $mail->bodyAdd("END"); $mail->send(); header("Location: classified_success.php"); } else { $errorText = "<ul>" . $errorText . "</ul>"; } } require "top.php";
function sendWebcastRegistrationAdmin($orderInfo) { $objEmailer = new Emailer(); $objLayout = new LayoutModel(); $objTemplate = new TemplatesModel(); $objSettings = Settings::getInstance(); $adminEmail = $objSettings->getEntry('admin', 'admin-email'); $layoutInfo = $objLayout->loadLayout(28); $template = $objTemplate->loadTemplateFromKeyname('email-webcastregistration-admin'); $this->view->assign('orderInfo', $orderInfo); $objEmailer->setFrom('*****@*****.**'); $objEmailer->addTo($adminEmail); $objEmailer->setSubject('WEBCAST PURCHASE'); // render template $this->view->assign('content', $this->view->fetch('fromstring:' . $template['content'])); $this->view->assign('sidebar_left', $this->view->fetch('fromstring:' . $template['left_sidebar'])); $this->view->assign('sidebar_right', $this->view->fetch('fromstring:' . $template['right_sidebar'])); $objEmailer->setBody($this->view->fetch('fromstring:' . $layoutInfo['code']), true); $objEmailer->sendMail(); return true; }
$errorText .= "<li>Website link is {$result}"; } if ($supplier->tel != "" && ($result = validate($supplier->tel, "phonenumber", 255)) !== true) { $errorText .= "<li>Telephone number is {$result}"; } if ($errorText == "") { if (!file_exists("logos")) { mkdir("logos"); } $supplier->Save(); if ($isNew == 1) { require "class.email.php"; $mail = new Emailer(); $mail->setFrom($configuration["fromEmail"]); $mail->setTo($configuration["adminEmail"]); $mail->setSubject("New Services Taken"); $mail->bodyAdd("Dear admin,"); $mail->bodyAdd(""); $mail->bodyAdd("Just to let you know the following services have been taken by " . $user->first_name . " " . $user->last_name); $mail->bodyAdd("Service: supplier"); $mail->send(); } header("Location: supplier_success.php"); } else { $errorText = "<ul>" . $errorText . "</ul>"; } } ?> <?php require "top.php";
$data = mysql_fetch_row($results); $cv_first_name = $data[0]; $cv_last_name = $data[1]; $cv_email = $data[2]; if ((bool) $_POST["submitting"]) { $jobId = (int) $_POST["jobIds"]; $queryJob = $db->Query("SELECT contact_email FROM job WHERE jobid='{$jobId}'"); if ($db->Rows() <= 0) { // shouldn't really ever get here exit; } $data = mysql_fetch_row($queryJob); $job_contact_email = $data[0]; $mail = new Emailer(); $mail->setTo($cv_email); $mail->setSubject("An employer wishes to contact you"); $mail->setFrom($configuration["fromEmail"]); $mail->bodyAdd(generateEmail($cv_first_name, $cv_last_name, $jobId, $job_contact_email)); $mail->send(); header("Location: cv_contact_success.php"); exit; } $queryJob = $db->Query("SELECT jobid, position, location, contact_email FROM job WHERE onlineuser_onlineuserid='" . $user->onlineuserId . "' AND dt_expire>'" . date("Y-m-d") . "'"); if ($db->Rows() <= 0) { // you will only reach here if the current user does not have a live job exit; } $jobCount = $db->Rows(); if ($jobCount == 1) { $jobId = mysql_fetch_row($queryJob); $jobId = $jobId[0];