Since: 5.0.0
Author: Al Brookbanks
Inheritance: extends PHPMailer
Beispiel #1
0
 public function executeRegistrationSubmit(sfWebRequest $request)
 {
     $this->forwardErrorIf($this->getUser()->isAuthenticated(), "User can not register if already logged in.");
     $this->forward404Unless($request->isMethod('post'));
     $this->form = new RegistrationForm();
     $this->form->bind($request->getParameter('register'));
     if ($this->form->isValid()) {
         $account = $this->form->save();
         $profile = new Profile();
         $profile->uid = $account->id;
         $profile->username = $account->username;
         $profile->first_name = $request->getPostParameter('register[first_name]');
         $profile->middle_name = $request->getPostParameter('register[middle_name]');
         $profile->last_name = $request->getPostParameter('register[last_name]');
         $profile->name = $profile->first_name . " " . $profile->middle_name . " " . $profile->last_name;
         $profile->pic = "0.jpg";
         $profile->save();
         $mailer = new Mailer();
         if ($mailer->send($account->email, sfConfig::get('app_registration_email_from_address'), sfConfig::get('app_site_name'), sfConfig::get('app_registration_email_subject'), "                    \nDear " . $profile->first_name . ",\n\n\nWelcome to " . sfConfig::get('app_site_name') . ".  We are very pleased you decided to start the\nnext generation of your online social life with us!  Below you will\nfind an activation link.  Please click this link to verify your\naccount before logging in.  If you have any trouble, please contact\nus via the \"Contact\" link on the home page of our web site.\n\n\nVERIFICATION LINK (Please click or paste into your browser address bar)\n-----------------------------------------------------------------------\n" . "http://rks.ath.cx:8080" . $this->generateUrl('verify') . '/id/' . $account->id . '/vid/' . md5($account->created_at) . "\n-----------------------------------------------------------------------\n\nIf you feel you were added to our system by mistake, please contact\nus via the \"Contact\" link on the home page of our web site.\n\n--The " . sfConfig::get('app_site_name') . " Support Team\n                    ")) {
             $this->getUser()->setFlash('info', "Registration was successful, please check your email to verify your account");
             $this->redirect('account/login');
         } else {
             $this->getUser()->setFlash('error', "Error occured sending with our mail server, please register again using a different username");
             $this->redirect('account/register');
         }
     }
     $this->setTemplate('register');
 }
 function actionPerform(&$skin, $moduleID)
 {
     $recordSet = $skin->main->databaseConnection->Execute("SELECT user_groups.* , COUNT(users.name) AS user_count \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$skin->main->databaseTablePrefix}user_groups AS user_groups LEFT OUTER JOIN\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$skin->main->databaseTablePrefix}users AS users\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id = users.user_group_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id>1\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id");
     //Check for error, if an error occured then report that error
     if (!$recordSet) {
         trigger_error("Unable to get user list\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
     } else {
         $rows = $recordSet->GetRows();
         $skin->main->controlVariables["sendMessage"]['groupList'] = $rows;
         $skin->main->controlVariables["sendMessage"]['moduleId'] = $this->getModuleID($skin->main);
     }
     $skin->main->controlVariables["sendMessage"]['errorInfo'] = "";
     $skin->main->controlVariables["sendMessage"]['succeed'] = false;
     if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage') {
         $mailer = new Mailer($skin->main);
         for ($i = 0; $i < sizeof($_POST["groups"]); $i++) {
             $recordSet = $skin->main->databaseConnection->Execute("SELECT username FROM {$skin->main->databaseTablePrefix}users AS users WHERE user_group_id=" . $_POST['groups'][$i]);
             if (!$recordSet) {
                 trigger_error("Unable to get group members\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
                 return "";
             } else {
                 $rows = $recordSet->GetRows();
                 for ($j = 0; $j < sizeof($rows); $j++) {
                     $mailer->addUserAddress($rows[$j]["username"]);
                 }
             }
         }
         $mailer->Subject = $_POST["subject"];
         $mailer->Body = $_POST["content"];
         $mailer->Send();
         $skin->main->controlVariables["sendMessage"]['errorInfo'] = $mailer->ErrorInfo;
         $skin->main->controlVariables["sendMessage"]['succeed'] = $mailer->ErrorInfo == "";
     }
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     //
     $mailer->send('emails.welcome', ['user' => $this->user], function ($m) {
         //
     });
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $mailer->send('mail.welcome', ['data' => 'data'], function ($message) {
         $message->from('*****@*****.**', 'Christian Nwmaba');
         $message->to('*****@*****.**');
     });
 }
Beispiel #5
0
 /**
  * Send a email with the password.
  * @param $user
  */
 protected function sendEmailOfNotification($user)
 {
     $this->mailer->send('jupiter::emails.password-notification', $user, function ($message) use($user) {
         $message->from(config('jupiter.emails.from.email'), config('jupiter.emails.from.name'));
         $message->to($user['email'], $user['name'])->subject('Welcome to our application.');
     });
 }
Beispiel #6
0
/**
 * Init mail engine
 *
 * @return boolean always true
 */
function fn_init_mailer()
{
    if (defined('MAILER_STARTED')) {
        return true;
    }
    $mailer_settings = fn_get_settings('Emails');
    if (!(include DIR_CORE . 'class.mailer.php')) {
        fn_error(debug_backtrace(), "Can't find Mail class", false);
    }
    $mailer = new Mailer();
    $mailer->LE = defined('IS_WINDOWS') ? "\r\n" : "\n";
    $mailer->PluginDir = DIR_LIB . 'phpmailer/';
    if ($mailer_settings['mailer_send_method'] == 'smtp') {
        $mailer->IsSMTP();
        $mailer->SMTPAuth = $mailer_settings['mailer_smtp_auth'] == 'Y' ? true : false;
        $mailer->Host = $mailer_settings['mailer_smtp_host'];
        $mailer->Username = $mailer_settings['mailer_smtp_username'];
        $mailer->Password = $mailer_settings['mailer_smtp_password'];
    } elseif ($mailer_settings['mailer_send_method'] == 'sendmail') {
        $mailer->IsSendmail();
        $mailer->Sendmail = $mailer_settings['mailer_sendmail_path'];
    } else {
        $mailer->IsMail();
    }
    Registry::set('mailer', $mailer);
    define('MAILER_STARTED', true);
    return true;
}
Beispiel #7
0
 public function lostpass()
 {
     if ($this->f3->exists('POST.lostpass')) {
         $audit = \Audit::instance();
         $this->f3->scrub($_POST);
         $this->f3->set('SESSION.flash', array());
         $members = new Members($this->db);
         // validate form
         if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
         }
         if ($members->count(array('email=?', $this->f3->get('POST.email'))) == 0) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Couldn\'t find an account associated with that email address.'));
         }
         if (count($this->f3->get('SESSION.flash')) === 0) {
             // generate random password
             $this->f3->set('password', md5(time()));
             $this->f3->set('POST.password', password_hash($this->f3->get('password'), PASSWORD_DEFAULT));
             $mailer = new Mailer();
             $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Password Reset')->setFrom(array($this->f3->get('noreplyemail') => $this->f3->get('tcgname')))->setTo(array($this->f3->get('POST.email')))->setReplyTo(array($this->f3->get('tcgemail')))->setBody(Template::instance()->render('app/templates/emails/pwreset.htm'), 'text/html');
             // save new password and email to member
             if ($members->edit($members->read(array('email=?', $this->f3->get('POST.email')), [])[0]->id, array('password')) && $mailer->send($message)) {
                 $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your password has been reset! Please check your email.'));
             } else {
                 $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'Password reset failed. Please try again or contact us for assistance.'));
             }
         }
     }
     $this->f3->set('content', 'app/views/lostpass.htm');
     echo Template::instance()->render('app/templates/default.htm');
 }
 function sandmailAction()
 {
     $firstnameErrText = "";
     $lastnameErrText = "";
     $addressErrText = "";
     $exemplarsErrText = "";
     if (empty($_POST['firstname'])) {
         $firstnameErrText = "не ввели имя!";
     }
     if (empty($_POST['lastname'])) {
         $lastnameErrText = "<span class=err> не ввели фамилию! </span> ";
     }
     if (empty($_POST['address'])) {
         $addressErrText = "<span class=err> не ввели адрес! </span> ";
     }
     if (empty($_POST['exemplars'])) {
         $exemplarsErrText = "<span class=err> не выбрано количество! </span> ";
     }
     if (!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['address']) && !empty($_POST['exemplars'])) {
         $body = $row['FIO'] . "\r\n" . $row['BookName'] . ", количество: " . $_POST["exemplars"] . "\r\n" . $_POST["firstname"] . " " . $_POST["lastname"] . " " . $_POST["address"];
         $title = substr(htmlspecialchars(trim($_POST['lastname'])), 0, 1000) . " ";
         $title .= substr(htmlspecialchars(trim($_POST['firstname'])), 0, 1000) . ", ";
         $title .= "Адресс :" . substr(htmlspecialchars(trim($_POST['address'])), 0, 1000);
         $to = '*****@*****.**';
         $sendaddress = mail($to, $title, 'Заказ:' . $body);
         $mailer = new Mailer();
         try {
             $mailer->send($to, $title, 'Заказ:' . $body);
         } catch (Exception $err) {
             $sendaddressErr = true;
         }
     }
     include_once 'views/sendmail.tpl';
 }
 /**
  * Transport a mail.
  *
  * @param string $strRecipientEmail
  * @param Mail   $email
  *
  * @return void
  * @throws AvisotaTransportException
  */
 public function transportEmail($recipient, Mail $email)
 {
     global $page;
     try {
         // set sender email
         if ($this->config->sender) {
             $email->setSender($this->config->sender);
         } else {
             if (isset($page) && strlen($page->adminEmail)) {
                 $email->setSender($page->adminEmail);
             } else {
                 $email->setSender($GLOBALS['TL_CONFIG']['adminEmail']);
             }
         }
         // set sender name
         if (strlen($this->config->senderName)) {
             $email->setSenderName($this->config->senderName);
         }
         // set reply email
         if ($this->config->replyTo) {
             $email->setReplyTo($this->config->replyTo);
         }
         // set reply name
         if ($this->config->replyToName) {
             $email->setReplyToName($this->config->replyToName);
         }
         $this->mailer->send($email, $recipient);
     } catch (Swift_RfcComplianceException $e) {
         throw new AvisotaTransportEmailException($recipient, $email, $e->getMessage(), $e->getCode(), $e);
     }
 }
Beispiel #10
0
 /**
  * Handles requested "/" route
  */
 public function indexAction()
 {
     // handle contact form
     if (!empty($_POST['form_submit'])) {
         $formValidator = new FormValidator($_POST['form'], $this->view);
         // if there were no errors
         if ($formValidator->isValid()) {
             // format user submitted data
             $data = array();
             $data[] = '<table>';
             foreach ($_POST['form'] as $field => $value) {
                 $data[] = '<tr><th>' . ucwords(str_replace(array('-', '_'), ' ', $field)) . '</th><td>' . nl2br($value) . '</td></tr>';
             }
             $data[] = '</table>';
             // send message
             $mailer = new Mailer();
             $result = $mailer->sendSystemMessage(implode("\n", $data), $_POST['form_submit']);
             if ($result) {
                 $this->router->redirect('/thanks');
                 die;
             }
         } else {
             $this->errorMessages = $formValidator->getFormattedErrors();
         }
     }
 }
 function actionPerform(&$skin, $moduleID)
 {
     $recordSet = $skin->main->databaseConnection->Execute("SELECT * FROM {$skin->main->databaseTablePrefix}users");
     //Check for error, if an error occured then report that error
     if (!$recordSet) {
         trigger_error("Unable to get user list\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
     } else {
         $rows = $recordSet->GetRows();
         $skin->main->controlVariables["sendMessage"]['userList'] = $rows;
         $skin->main->controlVariables["sendMessage"]['moduleId'] = $this->getModuleID($skin->main);
     }
     $skin->main->controlVariables["sendMessage"]['errorInfo'] = "";
     $skin->main->controlVariables["sendMessage"]['succeed'] = false;
     if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage') {
         $mailer = new Mailer($skin->main);
         for ($i = 0; $i < sizeof($_POST["users"]); $i++) {
             $mailer->addUserAddress($_POST["users"][$i]);
         }
         $mailer->Subject = $_POST["subject"];
         $mailer->Body = $_POST["content"];
         $mailer->Send();
         $skin->main->controlVariables["sendMessage"]['errorInfo'] = $mailer->ErrorInfo;
         $skin->main->controlVariables["sendMessage"]['succeed'] = $mailer->ErrorInfo == "";
     }
 }
Beispiel #12
0
 private function process()
 {
     $this->f3->scrub($_POST);
     $audit = \Audit::instance();
     $this->f3->set('SESSION.flash', array());
     // validate form
     if (!preg_match("/^[\\w\\- ]{2,30}\$/", $this->f3->get('POST.name'))) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid name.'));
     }
     if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address'));
     }
     if (!empty($this->f3->get('POST.url')) && !$audit->url($this->f3->get('POST.url'))) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid URL.'));
     }
     if (empty($this->f3->get('POST.message'))) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please include a message!'));
     }
     // honey pot
     if ($this->f3->get('POST.username') !== '') {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please do not use autofill or similar tools!'));
     }
     // if there are no errors, process the form
     if (count($this->f3->get('SESSION.flash')) === 0) {
         $this->f3->set('POST.level', $this->f3->get('member')->level + 1);
         $mailer = new Mailer();
         $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Contact Form')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('POST.email')))->setBody(Template::instance()->render('app/templates/emails/contact.htm'), 'text/html');
         if ($mailer->send($message)) {
             $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your form has been sent. Thanks for contacting us!'));
         } else {
             $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!'));
         }
     }
 }
 /**
  * Invitation form and processing of invited user details
  */
 public function actionIndex($p)
 {
     if ($this->request->isPost()) {
         $firstName = Fari_Decode::accents($this->request->getPost('first'));
         $lastName = Fari_Decode::accents($this->request->getPost('last'));
         $email = $this->request->getPost('email');
         if (!Fari_Filter::isEmail($email) or empty($firstName)) {
             $this->bag->message = array('status' => 'fail', 'message' => 'Whoops, make sure you enter a full name and proper email address.');
             $this->bag->first = $this->request->getRawPost('first');
             $this->bag->last = $this->request->getRawPost('last');
             $this->bag->email = $this->request->getRawPost('email');
         } else {
             $name = $this->accounts->newInvitation($firstName, $lastName, $email);
             // mail the instructions
             $mail = new Mailer();
             try {
                 $mail->sendInvitation();
             } catch (UserNotFoundException $e) {
                 $this->redirectTo('/error404/');
             }
             $this->flashSuccess = "{$name} is now added to your account. An email with instructions was sent to {$email}";
             $this->redirectTo('/users/');
         }
     }
     $this->bag->tabs = $this->user->inRooms();
     $this->renderAction('new');
 }
 /**
  * Handle the event.
  *
  * @param  BusinessWasFlagged  $event
  * @return void
  */
 public function handle(BusinessWasFlagged $event)
 {
     $data = ['user' => $event->user, 'business' => $event->business];
     $this->mailer->queue('emails.admin.business.user_sent_message', $data, function (Message $message) {
         $message->to(env('APP_EMAIL_SENDER', 'Toilets for Trans Folk'));
         $message->from(env('APP_EMAIL_SENDER', 'TFTF Web App'));
     });
 }
Beispiel #15
0
 /**
  * Felhasználói profil létrehozása.
  */
 private function createProfile()
 {
     if (isset($_POST['signUpSubmit'])) {
         include_once FRAME_PATH . 'Mailer.php';
         $mailer = new Mailer();
         $name = $this->db->real_escape_string($_POST['signUpName']);
         $email = $this->db->real_escape_string($_POST['signUpEmail']);
         $pass = $this->db->real_escape_string($_POST['signUpPassword']);
         $passCheck = $this->db->real_escape_string($_POST['signUpPasswordCheck']);
         if (empty($name)) {
             echo '<div class="absErrorHolder"><div class="error">' . SIGNUP_E1 . '</div></div>';
         } else {
             if (empty($email)) {
                 echo '<div class="absErrorHolder"><div class="error">' . SIGNUP_E2 . '</div></div>';
             } else {
                 if (!preg_match("/([\\w\\-]+\\@[\\w\\-]+\\.[\\w\\-]+)/", $email)) {
                     echo '<div class="absErrorHolder"><div class="error">' . SIGNUP_E4 . '</div></div>';
                 } else {
                     if (empty($pass)) {
                         echo '<div class="absErrorHolder"><div class="error">' . SIGNUP_E5 . '</div></div>';
                     } else {
                         if (strlen($pass) < 8) {
                             echo '<div class="absErrorHolder"><div class="error">' . SIGNUP_E6 . '</div></div>';
                         } else {
                             if ($pass != $passCheck) {
                                 echo '<div class="absErrorHolder"><div class="error">' . SIGNUP_E7 . '</div></div>';
                             } else {
                                 $checkEmail = $this->db->query("SELECT email FROM users WHERE email = '" . $email . "'") or $this->dbLog($this->db, self::ME, __LINE__);
                                 if ($checkEmail->num_rows < 1) {
                                     $pass_hash = $this->passwordHash($pass);
                                     $userId = $this->createId($this->db, 12, "users", "userId");
                                     $url_token = $this->createId($this->db, 20, "users", "token");
                                     $sql = "INSERT INTO users (userID, userName, email, password, rights, token) VALUES ('" . $userId . "', '" . $name . "', '" . $email . "', '" . $pass_hash . "', 'pending', '" . $url_token . "')";
                                     $this->db->query($sql) or $this->dbLog($this->db, self::ME, __LINE__);
                                     $mailer->sendAutoMail($email, SIGNUP_MAIL_SUBJECT, SIGNUP_MAIL_BODY . '<a href="http://majtenyim.matyasvendeglo.hu/index.php?m=settings&a=confirmProfile&token=' . $url_token . '">' . SIGNUP_CONFIRM_BTN . '</a>');
                                     $objectId = $this->createId($this->db, 20, 'objects', 'objectId');
                                     $token = $this->createId($this->db, 24, 'objects', 'token');
                                     $sql = "INSERT INTO objects (objectId,token) VALUES ('" . $objectId . "','" . $token . "')";
                                     $this->db->query($sql) or $this->dbLog($this->db, self::ME, __LINE__);
                                     mkdir('sky/' . $token);
                                     $sql = "INSERT INTO metadata (objectId,objectName,objectType,objectSize,owner,lastModifiedByOnline) VALUES ('" . $objectId . "','" . $token . "','folder','0','" . $userId . "','" . date('Y-m-d H:i:s') . "')";
                                     $this->db->query($sql) or $this->dbLog($this->db, self::ME, __LINE__);
                                     $sql = "UPDATE users SET cloudObject = '" . $objectId . "' WHERE userId = '" . $userId . "'";
                                     $this->db->query($sql) or $this->dbLog($this->db, self::ME, __LINE__);
                                     echo '<div class="absErrorHolder"><div class="succeed">' . SIGNUP_SUCCESS . '</div></div>';
                                 } else {
                                     echo '<div class="absErrorHolder"><div class="error">' . SIGNUP_E3 . '</div></div>';
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
function hook_shipment_post(&$user, &$shipment, &$session)
{
    $mailer = new Mailer($user['folder']);
    $mailer->addRcpt($shipment->ship_contact, '*****@*****.**');
    $mailer->dataObj = $shipment->toArray();
    $mailer->dataObj['del_note'] = $session->account_notes . " " . $mailer->dataObj['del_note'];
    $mailer->template = "order_summary";
    $mailer->subject = "WEB ORDER #" . $shipment->ext_id;
    $mailer->send();
}
 public function send($parsed_object, $parcel, $debug = FALSE)
 {
     $parsed_object->settings = $parcel->settings;
     $mailer = new Mailer($parsed_object);
     $response = $mailer->send();
     if (!$response) {
         $this->show_error('An unknown error has occurred when sending email with your server.');
     }
     return new Postmaster_Service_Response(array('status' => $response ? POSTMASTER_SUCCESS : POSTMASTER_FAILED, 'parcel_id' => $parcel->id, 'channel_id' => isset($parcel->channel_id) ? $parcel->channel_id : FALSE, 'author_id' => isset($parcel->entry->author_id) ? $parcel->entry->author_id : FALSE, 'entry_id' => isset($parcel->entry->entry_id) ? $parcel->entry->entry_id : FALSE, 'gmt_date' => $this->now, 'service' => $parcel->service, 'to_name' => $parsed_object->to_name, 'to_email' => $parsed_object->to_email, 'from_name' => $parsed_object->from_name, 'from_email' => $parsed_object->from_email, 'cc' => $parsed_object->cc, 'bcc' => $parsed_object->bcc, 'subject' => $parsed_object->subject, 'message' => !empty($parsed_object->message) ? $parsed_object->message : $parsed_object->html_message, 'html_message' => $parsed_object->html_message, 'plain_message' => $parsed_object->plain_message, 'parcel' => $parcel));
 }
 /**
  * Send an email as both HTML and plaintext
  * 
  * @return bool
  */
 public function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false)
 {
     $result = $this->sendPostmarkEmail($to, $from, $subject, $htmlContent, $attachedFiles, $customheaders, $plainContent);
     if ($result === false) {
         // Fall back to regular Mailer
         $fallbackMailer = new Mailer();
         $result = $fallbackMailer->sendHTML($to, $from, $subject, $htmlContent, $attachedFiles, $customheaders, $plainContent);
     }
     return $result;
 }
Beispiel #19
0
 /**
  * send_account_enabled
  * This sends the account enabled email for the specified user
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public static function send_account_enabled($username, $fullname, $email)
 {
     $mailer = new Mailer();
     $mailer->set_default_sender();
     $mailer->subject = sprintf(T_("Account enabled at %s"), AmpConfig::get('site_title'));
     $mailer->message = sprintf(T_("Your account %s has been enabled\n\n\n            Please logon using %s"), $username, AmpConfig::get('web_path') . "/login.php");
     $mailer->recipient = $email;
     $mailer->recipient_name = $fullname;
     $mailer->send();
 }
Beispiel #20
0
function hook_rate_post(&$user, &$shipment, &$session)
{
    $mailer = new Mailer($user['folder']);
    $mailer->addRcpt($shipment->ship_contact, '*****@*****.**');
    // change to pickups @ minimaxexpress.com upon launch
    $mailer->addReplyTo($shipment->ship_contact, $shipment->ship_email);
    $mailer->dataObj = $shipment->toArray();
    $mailer->dataObj['attn'] = "Please respond to this rate inquiry!";
    $mailer->template = "quote_summary";
    $mailer->subject = "New Rate Inquiry";
    $mailer->send();
}
Beispiel #21
0
 protected function sendMail()
 {
     $mail = new Mailer();
     $mail->From = $_REQUEST['emailFrom'];
     $mail->FromName = $_REQUEST['emailFrom'];
     foreach (explode(",", $_REQUEST['emailTo']) as $emailTo) {
         $mail->AddAddress($emailTo);
     }
     $mail->Subject = $_REQUEST['subject'];
     //$mail->setBodyFromTemplate($data=array(), $template="mail_generic", $altBody=""
     $mail->setBodyFromTemplate(array('body' => $_REQUEST['body']));
     return $mail->Send();
 }
Beispiel #22
0
 /**
  * 重新发送邮件
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-06-13 17:39:13
  *
  * @return void 无返回值
  */
 public function afreshSendAction()
 {
     $msg = L('AFRESH,SEND,CN_YOUJIAN');
     if (!($data = $this->_getPairsData('history_id,add_time'))) {
         $this->_ajaxReturn(false, L('INVALID_PARAM,%data。') . $msg . L('FAILURE'));
     }
     require LIB_PATH . 'Mailer.class.php';
     $mailer = new Mailer($this->_model);
     foreach ($data as $item) {
         $mailer->doMail($item);
     }
     $this->_model->addLog($msg . join(',', array_keys($data)) . L('SUCCESS'), LOG_TYPE_ADMIN_OPERATE);
     $this->_ajaxReturn(true, $msg . L('SUCCESS'));
 }
 public function onSetAnswer(FrontController $sender, Statement $st)
 {
     $users = $st->getSubscribers();
     if ($users) {
         require_once ST_DIR . '/Classes/Mailer.php';
         $mailer = new Mailer();
         $vars = array('answer' => strip_tags($st->getAnswer()), 'st_link' => FrontController::getURLByRoute('view', array('id' => $st->getId()), true), 'title' => $st->getTitle(), 'status' => $st->getStatusName());
         foreach ($users as $user) {
             $vars['username'] = $user->name;
             $vars['unSubscribeLink'] = $this->_getSubscribeLink($user->email, $user->user_id, $st->getId());
             $mailer->sendMail('SubscribeStatementSetAnswer', $user->email, $vars);
         }
     }
 }
Beispiel #24
0
 public function getConfiguredMailer()
 {
     if (!$this->mailer_config) {
         throw new Exception('MailerBlast needs to have the mailer configured.');
     }
     $mlr = new Mailer();
     foreach ($this->mailer_config as $k => $v) {
         switch ($k) {
             case 'cc':
                 $mlr->addCc($v);
                 break;
             case 'bcc':
                 $mlr->addBcc($v);
                 break;
             case 'from':
                 $mlr->setFrom($v);
                 break;
             case 'replyto':
                 $mlr->setReplyTo($v);
                 break;
             case 'subject':
                 $mlr->setSubject($v);
                 break;
             case 'content-type':
                 $mlr->setContentType($v);
                 break;
             case 'headers':
                 $mlr->headers .= $v;
                 break;
             default:
                 break;
         }
     }
     return $mlr;
 }
 /**
  * Define the services on the applications (should be registered)
  * @method register
  * @param  Application $app
  * @return void
  */
 public function register(Application $app)
 {
     if (!isset($app['security.jwt.encoder'])) {
         throw new RuntimeException('Missing dependencies: SecurityJWTServiceProvider');
     }
     if (!isset($app['db'])) {
         throw new RuntimeException('Missing dependencies: DoctrineServiceProvider');
     }
     if (!isset($app['security.voters'])) {
         throw new RuntimeException('Missing dependencies: SecurityServiceProvider');
     }
     // clean simple-user-jwt options
     $app['user.jwt.options'] = isset($app['user.jwt.options']) ? $app['user.jwt.options'] : [];
     $app['user.jwt.options'] = array_replace_recursive(['class' => 'SimpleUser\\JWT\\User', 'controller' => 'SimpleUser\\JWT\\UserController', 'language' => 'SimpleUser\\JWT\\Languages\\English', 'registrations' => ['enabled' => true, 'confirm' => false], 'invite' => ['enabled' => false], 'forget' => ['enabled' => false], 'tables' => ['users' => 'users', 'customfields' => 'user_custom_fields'], 'mailer' => ['enabled' => false, 'from' => ['email' => 'do-not-reply@' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : gethostname()), 'name' => null], 'templates' => ['register' => ['confirm' => 'confirm.twig', 'welcome' => 'welcome.twig'], 'invite' => 'invite.twig', 'forget' => 'forget.twig'], 'routes' => ['login' => 'user.jwt.login', 'reset' => 'user.jwt.reset']]], $app['user.jwt.options']);
     // mailer check
     if ($app['user.jwt.options']['mailer']['enabled']) {
         if (!isset($app['mailer'])) {
             throw new RuntimeException('Missing dependencies: SwiftMailerServiceProvider');
         }
         if (!isset($app['url_generator'])) {
             throw new RuntimeException('Missing dependencies: UrlGeneratorServiceProvider');
         }
         if (!isset($app['twig'])) {
             throw new RuntimeException('Missing dependencies: TwigServiceProvider');
         }
     } else {
         if ($app['user.jwt.options']['invite']['enabled']) {
             throw new LogicException('If you want to enable invite, you need to configure the mailer');
         }
         if ($app['user.jwt.options']['forget']['enabled']) {
             throw new LogicException('If you want to enable forget, you need to configure the mailer');
         }
     }
     // mailer
     $app['user.jwt.mailer'] = $app->share(function ($app) {
         $mailer = new Mailer(new \Swift_Mailer($app['swiftmailer.transport']), $app['url_generator'], $app['twig']);
         $mailer->setFromAddress($app['user.jwt.options']['mailer']['from']['email']);
         $mailer->setFromName($app['user.jwt.options']['mailer']['from']['name']);
         return $mailer;
     });
     // generate simple-user options
     $app['user.options'] = ['mailer' => ['enabled' => false], 'userClass' => $app['user.jwt.options']['class'], 'userTableName' => $app['user.jwt.options']['tables']['users'], 'userCustomFieldsTableName' => $app['user.jwt.options']['tables']['customfields']];
     // register simple-user
     $app->register(new UserServiceProvider());
     // cnam/security-jwt-service-provider need the users list in $app['users']
     $app['users'] = $app->share(function () use($app) {
         return $app['user.manager'];
     });
 }
 function actionPerform(&$skin, $moduleID)
 {
     $skin->main->controlVariables["feedBack"]['tabId'] = $skin->main->selectedTab;
     $skin->main->controlVariables["feedBack"]['error'] = false;
     $skin->main->controlVariables["feedBack"]['succeed'] = false;
     if (isset($_POST["event"]) && $_POST["event"] == 'feedBack') {
         $mailer = new Mailer($skin->main);
         $mailer->AddAddress($mailer->From, $mailer->FromName);
         $mailer->Subject = "FeedBack from your web site";
         $mailer->Body = $_POST["content"];
         $mailer->Send();
         $skin->main->controlVariables["feedBack"]['errorInfo'] = $mailer->ErrorInfo != "";
         $skin->main->controlVariables["feedBack"]['succeed'] = $mailer->ErrorInfo == "";
     }
 }
Beispiel #27
0
function commentOn($id, $comment)
{
    global $group_name;
    $p = new PeoplePage($group_name);
    $c = $p->insertComment($id, $comment);
    if ($c) {
        $m = new Mailer(_getMemberUsername($id), $group_name);
        $m->youGotAWallMessage();
        return '1';
        // true
    } else {
        return '0';
    }
    // false
}
Beispiel #28
0
 /**
  * Setup the instance (singleton)
  *
  * @return Mailer
  */
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Beispiel #29
0
 /**
  * @return Mailer
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function control()
 {
     $config = Config::getInstance();
     $this->addToView('is_registration_open', $config->getValue('is_registration_open'));
     if (isset($_POST['Submit']) && $_POST['Submit'] == 'Send Reset') {
         $this->disableCaching();
         $dao = DAOFactory::getDAO('OwnerDAO');
         $user = $dao->getByEmail($_POST['email']);
         if (isset($user)) {
             $token = $user->setPasswordRecoveryToken();
             $es = new ViewManager();
             $es->caching = false;
             $es->assign('apptitle', $config->getValue('app_title_prefix') . "ThinkUp");
             $es->assign('recovery_url', "session/reset.php?token={$token}");
             $es->assign('application_url', Utils::getApplicationURL($false));
             $es->assign('site_root_path', $config->getValue('site_root_path'));
             $message = $es->fetch('_email.forgotpassword.tpl');
             Mailer::mail($_POST['email'], $config->getValue('app_title_prefix') . "ThinkUp Password Recovery", $message);
             $this->addSuccessMessage('Password recovery information has been sent to your email address.');
         } else {
             $this->addErrorMessage('Error: account does not exist.');
         }
     }
     $this->view_mgr->addHelp('forgot', 'userguide/accounts/index');
     $this->setViewTemplate('session.forgot.tpl');
     return $this->generateView();
 }