setParams() публичный Метод

Sets the parameters for the email view and the Placeholders
public setParams ( array $params ) : Mail
$params array
Результат Mail Provides fluent interface
 /**
  * Process OrderState for Order
  *
  * @param CoreShopOrder $order
  * @param null $locale
  * @return bool
  * @throws \Exception
  */
 public function processStep(CoreShopOrder $order, $locale = null)
 {
     $emailDocument = $this->getEmailDocument($locale);
     $emailParameters = array("order" => $order, "newOrderStatus" => $this, "user" => $order->getCustomer());
     if ($this->getAccepted()) {
     }
     if ($this->getShipped()) {
     }
     if ($this->getPaid()) {
         Plugin::actionHook("paymentConfirmation", array("order" => $order));
     }
     Plugin::actionHook("orderStatusUpdate", array("newOrderStatus" => $this, "order" => $order));
     if ($this->getEmail() && $emailDocument instanceof Document\Email) {
         $mail = new Mail();
         $mail->setDocument($emailDocument);
         $mail->setParams($emailParameters);
         $mail->addTo($order->getCustomer()->getEmail(), $order->getCustomer()->getFirstname() . " " . $order->getCustomer()->getLastname());
         Tool::addAdminToMail($mail);
         $mail->send();
     }
     $order->setOrderState($this);
     $order->save();
     return true;
     //TODO: Stock Management
 }
 /**
  * @param object $participation
  * @return void
  * @throws \Exception
  */
 public function sendEmail($participation)
 {
     $email = $participation->getEmail();
     $emailDomain = trim(strtolower(preg_replace('/^[^@]+@/', '', $email)));
     $participation->setEmailDomain($emailDomain);
     $participation->save();
     $confirmationLink = $this->createConfirmationLink($participation->getConfirmationCode());
     $parameters = array('confirmationLink' => $confirmationLink, 'participationId' => $participation->getId());
     $emailDocumentPath = Plugin::getConfig()->get('emailDocumentPath');
     $emailDocument = DocumentModel::getByPath($emailDocumentPath);
     if (!$emailDocument instanceof EmailDocument) {
         throw new \Exception("Error: emailDocumentPath [{$emailDocumentPath}] " . "is not a valid email document.");
     }
     $mail = new Mail();
     $mail->addTo($email);
     if ($this->getSubject()) {
         $mail->setSubject($this->getSubject());
     }
     $mail->setDocument($emailDocumentPath);
     $mail->setParams($parameters);
     $mail->send();
     $note = new Note();
     $note->setElement($participation);
     $note->setDate(time());
     $note->setType("confirmation");
     $note->setTitle("Email sent");
     $note->addData("email", "text", $email);
     $note->setUser(0);
     $note->save();
 }
Пример #3
0
 public function requestPasswordReset()
 {
     $this->setResetHash($this->createHash());
     $this->save();
     $doc = Email::getByPath(Config::get('emails')->passwordReset);
     if (!$doc) {
         throw new \Exception('No password reset email defined');
     }
     /** @var \Zend_Controller_Request_Http $request */
     $request = \Zend_Controller_Front::getInstance()->getRequest();
     $email = new Mail();
     $email->addTo($this->getEmail());
     $email->setDocument($doc);
     $email->setParams(['host' => sprintf('%s://%s', $request->getScheme(), $request->getHttpHost()), 'member_id' => $this->getId()]);
     $email->send();
     return $this;
 }
Пример #4
0
 /**
  * Callback for 'member.register.post' event.
  * Sending email with confirmation links.
  *
  * @param \Zend_EventManager_Event $event
  * @return \Member
  * @throws \Exception
  */
 public static function confirm(\Zend_EventManager_Event $event)
 {
     /** @var \Member $member */
     $member = $event->getTarget();
     $member->setConfirmHash($member->createHash());
     $member->save();
     $doc = Email::getByPath(Config::get('emails')->registerConfirm);
     if (!$doc) {
         throw new \Exception('No confirmation email defined');
     }
     /** @var \Zend_Controller_Request_Http $request */
     $request = \Zend_Controller_Front::getInstance()->getRequest();
     $email = new Mail();
     $email->addTo($member->getEmail());
     $email->setDocument($doc);
     $email->setParams(['host' => sprintf('%s://%s', $request->getScheme(), $request->getHttpHost()), 'member_id' => $member->getId()]);
     $email->send();
     return $member;
 }
Пример #5
0
 public function contactFormAction()
 {
     $success = false;
     if ($this->getParam("provider")) {
         $adapter = Tool\HybridAuth::authenticate($this->getParam("provider"));
         if ($adapter) {
             $user_data = $adapter->getUserProfile();
             if ($user_data) {
                 $this->setParam("firstname", $user_data->firstName);
                 $this->setParam("lastname", $user_data->lastName);
                 $this->setParam("email", $user_data->email);
                 $this->setParam("gender", $user_data->gender);
             }
         }
     }
     // getting parameters is very easy ... just call $this->getParam("yorParamKey"); regardless if's POST or GET
     if ($this->getParam("firstname") && $this->getParam("lastname") && $this->getParam("email") && $this->getParam("message")) {
         $success = true;
         $mail = new Mail();
         $mail->setIgnoreDebugMode(true);
         // To is used from the email document, but can also be set manually here (same for subject, CC, BCC, ...)
         //$mail->addTo("*****@*****.**");
         $emailDocument = $this->document->getProperty("email");
         if (!$emailDocument) {
             $emailDocument = Document::getById(38);
         }
         $mail->setDocument($emailDocument);
         $mail->setParams($this->getAllParams());
         $mail->send();
     }
     // do some validation & assign the parameters to the view
     foreach (["firstname", "lastname", "email", "message", "gender"] as $key) {
         if ($this->getParam($key)) {
             $this->view->{$key} = htmlentities(strip_tags($this->getParam($key)));
         }
     }
     // assign the status to the view
     $this->view->success = $success;
 }
Пример #6
0
 /**
  * @param $object
  * @param $mailDocument
  * @param array $params
  * @throws \Exception
  */
 public function sendConfirmationMail($object, $mailDocument, $params = [])
 {
     $defaultParameters = ["gender" => $object->getGender(), 'firstname' => $object->getFirstname(), 'lastname' => $object->getLastname(), "email" => $object->getEmail(), 'token' => $object->getProperty("token"), "object" => $object];
     $params = array_merge($defaultParameters, $params);
     $mail = new Mail();
     $mail->addTo($object->getEmail());
     $mail->setDocument($mailDocument);
     $mail->setParams($params);
     $mail->send();
 }
Пример #7
0
 public function getpassforgottenAction()
 {
     $reponse = new Reponse();
     if ($this->getRequest()->isGet() or $this->getRequest()->isPost()) {
         $email = $this->getParam('email');
         $member = Object\Person::getByEmail($email, 1);
         if ($member instanceof Object\Person) {
             $this->disableLayout();
             $password = $member->getPassword();
             $doc_change_pass = "******";
             $url = "http://" . $_SERVER['SERVER_NAME'] . $doc_change_pass . "?box=remind&email=" . $email . "&password="******" " . $member->getLastname(), 'email' => $email, 'password' => $password);
             $mail = new Pimcore\Mail();
             $mail->setParams($parameters);
             $mail->setDocument('/email/login_forgotten');
             $mail->AddTo($email);
             $mail->Send();
             $reponse->data = $parameters;
             $reponse->message = 'TXT_SENT_PASSWORD_MESSAGE';
             $reponse->success = true;
         } else {
             $reponse->message = 'TXT_EMAIL_INCORRECT';
             $reponse->success = false;
         }
     } else {
         $reponse->message = 'TXT_EMAIL_NOTRECEIVED';
         $reponse->success = false;
     }
     // $this->render($reponse);
     $this->forward("form-login", "login", null, array("email" => $email, "password" => $password, "error" => $reponse->message));
 }