setIgnoreDebugMode() public method

public setIgnoreDebugMode ( $value )
$value
Example #1
0
 /**
  * @param Model\Tool\Newsletter\Config $newsletter
  * @param Object\Concrete $object
  */
 public static function sendMail($newsletter, $object, $emailAddress = null, $hostUrl = null)
 {
     $params = ["gender" => $object->getGender(), 'firstname' => $object->getFirstname(), 'lastname' => $object->getLastname(), "email" => $object->getEmail(), 'token' => $object->getProperty("token"), "object" => $object];
     $mail = new Mail();
     $mail->setIgnoreDebugMode(true);
     if (\Pimcore\Config::getSystemConfig()->newsletter->usespecific) {
         $mail->init("newsletter");
     }
     if (!Tool::getHostUrl() && $hostUrl) {
         $mail->setHostUrl($hostUrl);
     }
     if ($emailAddress) {
         $mail->addTo($emailAddress);
     } else {
         $mail->addTo($object->getEmail());
     }
     $mail->setDocument(Document::getById($newsletter->getDocument()));
     $mail->setParams($params);
     // render the document and rewrite the links (if analytics is enabled)
     if ($newsletter->getGoogleAnalytics()) {
         if ($content = $mail->getBodyHtmlRendered()) {
             include_once "simple_html_dom.php";
             $html = str_get_html($content);
             if ($html) {
                 $links = $html->find("a");
                 foreach ($links as $link) {
                     if (preg_match("/^(mailto)/", trim(strtolower($link->href)))) {
                         continue;
                     }
                     $glue = "?";
                     if (strpos($link->href, "?")) {
                         $glue = "&";
                     }
                     $link->href = $link->href . $glue . "utm_source=Newsletter&utm_medium=Email&utm_campaign=" . $newsletter->getName();
                 }
                 $content = $html->save();
                 $html->clear();
                 unset($html);
             }
             $mail->setBodyHtml($content);
         }
     }
     $mail->send();
 }
Example #2
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;
 }
 public function sendTestEmailAction()
 {
     if (!$this->getUser()->isAllowed("emails")) {
         throw new \Exception("Permission denied, user needs 'emails' permission.");
     }
     $mail = new Mail();
     $mail->addTo($this->getParam("to"));
     $mail->setSubject($this->getParam("subject"));
     $mail->setIgnoreDebugMode(true);
     if ($this->getParam("type") == "text") {
         $mail->setBodyText($this->getParam("content"));
     } else {
         $mail->setBodyHtml($this->getParam("content"));
     }
     $mail->send();
     $this->_helper->json(array("success" => true));
 }