Пример #1
0
 function test_GetFullEmailName()
 {
     $this->assertEquals(Util::getFullEmail("*****@*****.**", "Joao"), '"Joao" <*****@*****.**>');
     $this->assertEquals(Util::getFullEmail("*****@*****.**", ""), '*****@*****.**');
     $this->assertEquals(Util::getFullEmail("*****@*****.**"), '*****@*****.**');
 }
Пример #2
0
 /**
  * CreatePage is called from module processor and decide the proper output XML.
  *
  * @return DOMNode object
  */
 public function CreatePage()
 {
     $myWords = $this->WordCollection();
     $ht = array();
     $hasError = false;
     if ($this->_fromName == "") {
         $ht[$myWords->Value("FLDNAME")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($this->_fromEmail == "") {
         $ht[$myWords->Value("FLDEMAIL")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     } else {
         if (strrpos($this->_fromEmail, "@") === false) {
             $ht[$myWords->Value("FLDEMAIL")] = $myWords->Value("FLDEMAIL") . " " . $myWords->Value("ERRORINVALID");
             $hasError = true;
         }
     }
     if ($this->_subject == "") {
         $ht[$myWords->Value("FLDSUBJECT")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($this->_message == "") {
         $ht[$myWords->Value("FLDMESSAGE")] = $myWords->Value("ERRORBLANK");
         $hasError = true;
     }
     if ($hasError) {
         return $this->CreatePageArgs($myWords->Value("MSGERROR"), $ht);
     } elseif (!XmlInputImageValidate::validateText($this->_context)) {
         $document = new XmlnukeDocument($myWords->ValueArgs("TITLE", array($this->_context->get("SERVER_NAME"))), $myWords->ValueArgs("ABSTRACT", array($this->_context->get("SERVER_NAME"))));
         $blockcenter = new XmlBlockCollection($myWords->Value("MSGERROR"), BlockPosition::Center);
         $document->addXmlnukeObject($blockcenter);
         $form = new XmlFormCollection($this->_context, "module:sendemail", $myWords->Value("MSGERROR"));
         $form->addXmlnukeObject(new XmlInputCaption($myWords->Value("RETRYVALIDATE")));
         $form->addXmlnukeObject(new XmlInputHidden("toname_id", $this->_context->get("toname_id")));
         $form->addXmlnukeObject(new XmlInputHidden("name", $this->_context->get("name")));
         $form->addXmlnukeObject(new XmlInputHidden("email", $this->_context->get("email")));
         $form->addXmlnukeObject(new XmlInputHidden("subject", $this->_context->get("subject")));
         $form->addXmlnukeObject(new XmlInputHidden("message", $this->_extraMessage . $this->_context->get("message")));
         $form->addXmlnukeObject(new XmlInputHidden("redirect", $this->_context->get("redirect")));
         $form->addXmlnukeObject(new XmlInputImageValidate(""));
         $buttons = new XmlInputButtons();
         $buttons->addSubmit($myWords->Value("RETRY"), "");
         $form->addXmlnukeObject($buttons);
         $blockcenter->addXmlnukeObject($form);
         return $document->generatePage();
     } else {
         $envelope = new MailEnvelope(MailUtil::getEmailFromID($this->_toName_ID), $this->_subject, $this->_extraMessage . $this->_message);
         $envelope->setFrom(MailUtil::getEmailFromID("DEFAULT", $this->_fromName));
         $envelope->setReplyTo(\ByJG\Mail\Util::getFullEmail($this->_fromEmail, $this->_fromName));
         $envelope->setBCC($this->_fromEmail);
         $envelope->Send();
         if ($this->_redirect != "") {
             //Redirect Here!!
             //Response.End
             return $document->generatePage();
         } else {
             $ht[$myWords->Value("FLDNAME")] = $this->_fromName . " [" . $this->_fromEmail . "]";
             $ht[$myWords->Value("FLDSUBJECT")] = $this->_subject;
             $ht[$myWords->Value("FLDMESSAGE")] = $this->_message;
             return $this->CreatePageArgs($myWords->Value("MSGOK"), $ht);
         }
     }
 }
Пример #3
0
 public function addBCC($email, $name = null)
 {
     $this->_bcc[] = Util::getFullEmail($email, $name);
 }
Пример #4
0
 /**
  * Send a email with user data profile
  *
  * @param LanguageCollection $myWords
  * @param String $name
  * @param String $user
  * @param String $email
  * @param String $password
  */
 protected function sendResetPasswordMessage($myWords, $name, $user, $email, $token)
 {
     $path = $this->_context->get("SCRIPT_NAME");
     $path = substr($path, 0, strrpos($path, "/") + 1);
     $url = "http://" . $this->_context->getServerName() . $path;
     $body = $myWords->ValueArgs("RESETPASSWORDMESSAGE", array($name, $this->_context->get("SERVER_NAME"), $user, $url . $this->_context->bindModuleUrl(str_replace('\\', '.', get_class()) . '?action=' . ModuleActionLogin::RESETPASSWORD . '&username='******'&resettoken=' . $token . '&returnurl=' . $this->_login->getReturnUrl())));
     $envelope = new MailEnvelope(Util::getFullEmail($email, $name), $myWords->Value("RESETSUBJECTMESSAGE", "[" . $this->_context->getServerName() . "]"), $body);
     $envelope->Send();
 }