public function contactSendAction()
 {
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $json = $this->captchaCheck($_POST);
         // var_dump($json->match);
         if (!$json->match) {
             throw new Exception("Captcha parameters does not match!!", 666);
         }
         $mail = new Pimcore_Mail();
         $mail->addTo($_POST['email']);
         $mail->setBodyText($_POST['comments']);
         $mail->send();
         die;
     }
     throw new Exception("This request method is not supperted here!!", 666);
 }
Example #2
0
 protected function sendConfirmationMail(OnlineShop_Framework_ICart $cart, OnlineShop_Framework_AbstractOrder $order)
 {
     $params = array();
     $params["cart"] = $cart;
     $params["order"] = $order;
     $params["ordernumber"] = $order->getOrdernumber();
     if ($order->getCustomer()) {
         $params["customer"] = $order->getCustomer();
         $email = $order->getCustomer()->getEmail();
     } else {
         $tmpCustomer = new Object_Customer();
         $tmpCustomer->setEmail($order->getGuestEmail());
         $tmpCustomer->setFirstname($order->getDeliveryAddressLine1());
         $tmpCustomer->setLastname($order->getDeliveryAddressLine2());
         $params["customer"] = $tmpCustomer;
         $email = $order->getGuestEmail();
     }
     $mail = new Pimcore_Mail(array("document" => $this->confirmationMail, "params" => $params));
     $mail->addTo($email);
     $mail->send();
 }
Example #3
0
 public function sendmailmessageAction()
 {
     $this->disableLayout();
     if ($this->getParam('sendmail') == "send") {
         $resaid = $this->getParam('resaid');
         $reservation = Object\Reservation::getById($resaid, 1);
         if ($reservation instanceof Object\Reservation) {
             $locationname = $reservation->getLocation()->getName();
             $resa = $reservation->getId();
             $email = $reservation->getGuest()->getEmail();
             $guestname = $reservation->getGuest()->getLastname();
             $parameters = array('location' => $locationname, 'bookingref' => $resa, 'message' => $this->getParam('message'), 'guestname' => $guestname);
             $mail = new Pimcore_Mail();
             $subject = 'Message ResaExpress - ' . $locationname;
             $mail->setParams($parameters);
             $mail->setReplyTo('*****@*****.**');
             $mail->setSubject($subject);
             $mail->setDocument('/fr/booking/standardmail');
             // $mail->setBody($body);
             $mail->addTo($email);
             $mail->addBcc('*****@*****.**');
             $mail->Send();
         }
     }
 }
Example #4
0
 /**
  * Helper to log the email to the database and the file system
  *
  * @static
  * @param Pimcore_Mail $mail
  */
 public static function logEmail(Pimcore_Mail $mail)
 {
     $emailLog = new Document_Email_Log();
     $document = $mail->getDocument();
     if ($document instanceof Document) {
         $emailLog->setDocumentId($document->getId());
     }
     $emailLog->setRequestUri(htmlspecialchars($_SERVER['REQUEST_URI']));
     $emailLog->setParams($mail->getParams());
     $emailLog->setSubject($mail->getSubject());
     $emailLog->setSentDate(time());
     $mailFrom = $mail->getFrom();
     if ($mailFrom) {
         $emailLog->setFrom($mailFrom);
     } else {
         $defaultFrom = $mail->getDefaultFrom();
         $tmpString = $defaultFrom['email'];
         if ($defaultFrom['name']) {
             $tmpString .= " (" . $defaultFrom["name"] . ")";
         }
         $emailLog->setFrom($tmpString);
     }
     $html = $mail->getBodyHtml();
     if ($html instanceof Zend_Mime_Part) {
         $emailLog->setBodyHtml($html->getRawContent());
     }
     $text = $mail->getBodyText();
     if ($text instanceof Zend_Mime_Part) {
         $emailLog->setBodyText($text->getRawContent());
     }
     $temporaryStorage = $mail->getTemporaryStorage();
     foreach (array('To', 'Cc', 'Bcc') as $key) {
         if (!empty($temporaryStorage[$key])) {
             if (method_exists($emailLog, 'set' . $key)) {
                 $emailLog->{"set{$key}"}(self::formatDebugReceivers($temporaryStorage[$key]));
             }
         }
     }
     $emailLog->save();
 }
Example #5
0
 public function checkErrorLogsDb()
 {
     $conf = Config::getSystemConfig();
     $config = $conf->applicationlog;
     if ($config->mail_notification->send_log_summary) {
         $receivers = preg_split("/,|;/", $config->mail_notification->mail_receiver);
         array_walk($receivers, function (&$value) {
             $value = trim($value);
         });
         $logLevel = (int) $config->mail_notification->filter_priority;
         $db = \Pimcore\Resource::get()->getResource();
         $query = "SELECT * FROM " . \Pimcore\Log\Helper::ERROR_LOG_TABLE_NAME . " WHERE maintenanceChecked IS NULL AND priority <= {$logLevel} order by id desc";
         $rows = $db->fetchAll($query);
         $limit = 100;
         $rowsProcessed = 0;
         $rowCount = count($rows);
         if ($rowCount) {
             while ($rowsProcessed < $rowCount) {
                 $entries = array();
                 if ($rowCount <= $limit) {
                     $entries = $rows;
                 } else {
                     for ($i = $rowsProcessed; $i < $rowCount && count($entries) < $limit; $i++) {
                         $entries[] = $rows[$i];
                     }
                 }
                 $rowsProcessed += count($entries);
                 $html = var_export($entries, true);
                 $html = "<pre>{$html}</pre>";
                 $mail = new \Pimcore_Mail();
                 $mail->setBodyHtml($html);
                 $mail->addTo($receivers);
                 $mail->setSubject('Error Log ' . \Pimcore_Tool::getHostUrl());
                 $mail->send();
             }
         }
         $db->query("UPDATE " . \Pimcore\Log\Helper::ERROR_LOG_TABLE_NAME . " set maintenanceChecked = 1");
     }
 }
 public function sendConfirmation($array)
 {
     $email = $array['email'];
     $sellocation = Object\Location::getById($array['locationid'], 1);
     $parameters = array('bookingref' => $array['id'], 'partysize' => $array['partysize'], 'serving' => $array['servingtitle'], 'location' => $array['locationname'], 'date' => $array['start']->get('dd-MM-YYYY'), 'slot' => $array['start']->get('HH:mm'), 'locationaddress' => $sellocation->getAddress(), 'locationzip' => $sellocation->getZip(), 'locationcity' => $sellocation->getCity(), 'locationtel' => $sellocation->getTel(), 'locationemail' => $sellocation->getEmail(), 'locationcity' => $sellocation->getCity(), 'locationurl' => $sellocation->getUrl(), 'guestname' => $array['firstlastname']);
     $mail = new Pimcore_Mail();
     $subject = 'Reservation confirmation';
     $mail->setParams($parameters);
     $mail->setReplyTo('*****@*****.**', $name = NULL);
     $mail->setSubject($subject);
     $mail->setDocument('/fr/booking/reservation-confirmation');
     // $mail->setBody($body);
     $mail->addTo($email);
     $mail->addBcc('*****@*****.**');
     $mail->Send();
 }
Example #7
0
 /**
  * Determines if mbayer html2text is installed (more information at http://www.mbayer.de/html2text/)
  * and uses it to automatically create a text version of the html email
  *
  * @static
  * @return void
  */
 protected static function determineHtml2TextIsInstalled()
 {
     exec('html2text -version', $output, $check);
     self::$html2textInstalled = !empty($output) ? true : false;
 }
 public function sendModification($array)
 {
     $email = $array['email'];
     if ($email != '') {
         $sellocation = Object\Location::getById($array['locationid'], 1);
         $parameters = array('bookingref' => $array['id'], 'partysize' => $array['partysize'], 'serving' => $array['servingtitle'], 'location' => $array['locationname'], 'date' => $array['start']->get('dd-MM-YYYY'), 'slot' => $array['start']->get('HH:mm'), 'preferredlanguage' => $array['preferredlanguage'], 'locationaddress' => $sellocation->getAddress(), 'locationzip' => $sellocation->getZip(), 'locationcity' => $sellocation->getCity(), 'locationtel' => $sellocation->getTel(), 'locationemail' => $sellocation->getEmail(), 'locationcity' => $sellocation->getCity(), 'locationurl' => $sellocation->getUrl(), 'guestname' => $array['firstlastname']);
         $mail = new Pimcore_Mail();
         $subject = 'Modification of Reservation';
         $mail->setParams($parameters);
         $mail->setReplyTo('*****@*****.**', $name = NULL);
         $mail->setSubject($subject);
         if ($array['preferredlanguage'] == "fr") {
             $mail->setDocument('/fr/booking/modification-confirmation');
         } else {
             $mail->setDocument('/fr/booking/modification-confirmation-en');
         }
         // $mail->setBody($body);
         $mail->addTo($email);
         $mail->addBcc('*****@*****.**');
         $mail->Send();
     }
 }
 /**
  * Resends the email to the recipients
  */
 public function resendEmailAction()
 {
     $success = false;
     $emailLog = Document_Email_Log::getById($this->_getParam('id'));
     if ($emailLog instanceof Document_Email_Log) {
         $mail = new Pimcore_Mail('utf-8');
         $mail->preventDebugInformationAppending();
         if ($html = $emailLog->getHtmlLog()) {
             $mail->setBodyHtml($html);
         }
         if ($text = $emailLog->getTextLog()) {
             $mail->setBodyText($text);
         }
         $mail->setFrom($emailLog->getFrom());
         foreach ($emailLog->getToAsArray() as $entry) {
             $mail->addTo($entry['email'], $entry['name']);
         }
         foreach ($emailLog->getCcAsArray() as $entry) {
             $mail->addCc($entry['email'], $entry['name']);
         }
         foreach ($emailLog->getBccAsArray() as $entry) {
             $mail->addBcc($entry['email']);
         }
         $mail->setSubject($emailLog->getSubject());
         $mail->send();
         $success = true;
     }
     $this->_helper->json(array("success" => $success));
 }
Example #10
0
 /**
  * @static
  * @param  $sender
  * @param  $recipients
  * @param  $subject
  * @return Pimcore_Mail
  */
 public static function getMail($recipients = null, $subject = null)
 {
     $mail = new Pimcore_Mail();
     if ($recipients) {
         if (is_string($recipients)) {
             $mail->addTo($recipients);
         } else {
             if (is_array($recipients)) {
                 foreach ($recipients as $recipient) {
                     $mail->addTo($recipient);
                 }
             }
         }
     }
     if ($subject) {
         $mail->setSubject($subject);
     }
     return $mail;
 }