예제 #1
0
 public function test()
 {
     $strTo = "postmaster@localhost";
     $intSentMails = 0;
     echo "\tsend a test email to " . $strTo . "...\n";
     $objMail = new class_mail();
     $objMail->setSender("*****@*****.**");
     $objMail->setSenderName("Kajona System a ö ü ");
     $objMail->addTo($strTo);
     $objMail->setSubject("Kajona test mail ä ö ü Kajona test mail ä ö ü Kajona test mail ä ö ü Kajona test mail ä ö ü Kajona test mail ä ö ü ");
     $objMail->setText("This is the plain text ä ö ü");
     $objMail->setHtml("This is<br />the <b>html-content ä ö ü</b><br /><img src=\"cid:IMG_3000.jpg\" />");
     $objMail->addAttachement("/files/images/samples/IMG_3000.jpg");
     $objMail->addAttachement("/files/images/samples/P3197800.jpg", "", true);
     if ($objMail->sendMail() === true) {
         $intSentMails++;
     }
     $this->assertEquals($intSentMails, 1, __FILE__ . " checkNrOfMails");
 }
 /**
  * Creates an email to send to a friend
  * @return void
  */
 private function sendForm()
 {
     //load url the user visited before
     $strUrl = $this->getHistory(2);
     $arrUrl = explode("&", $strUrl);
     $strPage = "";
     $strSystemid = "";
     $strParams = "";
     $strAction = "";
     foreach ($arrUrl as $arrOnePart) {
         $arrPair = explode("=", $arrOnePart);
         if ($arrPair[0] == "page") {
             $strPage = $arrPair[1];
         } else {
             if ($arrPair[0] == "systemid") {
                 $strSystemid = $arrPair[1];
             } else {
                 if ($arrPair[0] == "action") {
                     $strAction = $arrPair[1];
                 } else {
                     if ($arrPair[0] != "language") {
                         $strParams .= "&" . $arrPair[0] . "=" . $arrPair[1];
                     }
                 }
             }
         }
     }
     $strHref = getLinkPortalHref($strPage, "", $strAction, $strParams, $strSystemid, $this->getStrPortalLanguage());
     $arrMessage = array();
     $arrMessage["tellafriend_url"] = "<a href=\"" . $strHref . "\">" . $strHref . "</a>";
     $arrMessage["tellafriend_receiver_name"] = htmlStripTags($this->getParam("tellafriend_receiver_name"));
     $arrMessage["tellafriend_sender_name"] = htmlStripTags($this->getParam("tellafriend_sender_name"));
     $arrMessage["tellafriend_message"] = htmlStripTags($this->getParam("tellafriend_message"));
     $strMailTemplateID = $this->objTemplate->readTemplate("/element_tellafriend/" . $this->arrElementData["tellafriend_template"], "email_html");
     $strEmailBody = $this->fillTemplate($arrMessage, $strMailTemplateID);
     $objScriptlet = new class_scriptlet_helper();
     $strEmailBody = $objScriptlet->processString($strEmailBody);
     //TODO: check if we have to remove critical characters here?
     $strSubject = $this->fillTemplate(array("tellafriend_sender_name" => htmlStripTags($this->getParam("tellafriend_sender_name"))), $this->objTemplate->readTemplate("/element_tellafriend/" . $this->arrElementData["tellafriend_template"], "email_subject"));
     //TODO: check if we have to remove critical characters here?
     $objEmail = new class_mail();
     $objEmail->setSender($this->getParam("tellafriend_sender"));
     $objEmail->setSenderName($this->getParam("tellafriend_sender_name"));
     $objEmail->addTo($this->getParam("tellafriend_receiver"));
     $objEmail->setSubject($strSubject);
     $objEmail->setHtml($strEmailBody);
     if ($objEmail->sendMail()) {
         $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["tellafriend_success"]));
     } else {
         $this->portalReload(class_link::getLinkPortalHref($this->arrElementData["tellafriend_error"]));
     }
 }