public function sendemail($password = "******", $username = "******") { $data = array('password' => $password, 'username' => $username); $mail = new \Pimcore\Mail(); $mail->addTo($username); $mail->addBcc("*****@*****.**"); $mail->setBodyHtml("<b>some</b> rich text and password" . $password); $mail->send(); }
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\Db::get()->getResource(); $query = "SELECT * FROM " . \Pimcore\Log\Handler\ApplicationLoggerDb::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->setIgnoreDebugMode(true); $mail->setBodyHtml($html); $mail->addTo($receivers); $mail->setSubject('Error Log ' . \Pimcore_Tool::getHostUrl()); $mail->send(); } } $db->query("UPDATE " . \Pimcore\Log\Handler\ApplicationLoggerDb::TABLE_NAME . " set maintenanceChecked = 1"); } }
/** * Sends an email * @param array $users * @param Element\Note $note */ public static function sendEmailNotification($users, $note) { //try { $recipients = self::getNotificationUsers($users); if (!count($recipients)) { return; } $mail = new \Pimcore\Mail(); foreach ($recipients as $user) { /** * @var $user User */ $mail->addTo($user->getEmail(), $user->getName()); } $element = Element\Service::getElementById($note->getCtype(), $note->getCid()); $mail->setSubject("[pimcore] {$note->getTitle()}, {$element->getType()} [{$element->getId()}]"); //TODO decide some body text/html $mail->setBodyText($note->getDescription()); $mail->send(); //} catch(\Exception $e) { // //todo application log // } }
public function checkErrorLogsDb() { $db = \Pimcore\Db::get(); $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; $query = "SELECT * FROM " . \Pimcore\Log\Handler\ApplicationLoggerDb::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 = []; 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->setIgnoreDebugMode(true); $mail->setBodyHtml($html); $mail->addTo($receivers); $mail->setSubject('Error Log ' . \Pimcore\Tool::getHostUrl()); $mail->send(); } } } // flag them as checked, regardless if email notifications are enabled or not // otherwise, when activating email notifications, you'll receive all log-messages from the past and not // since the point when you enabled the notifications $db->query("UPDATE " . \Pimcore\Log\Handler\ApplicationLoggerDb::TABLE_NAME . " set maintenanceChecked = 1"); }
protected function sendConfirmationMail(OnlineShop_Framework_ICart $cart, OnlineShop_Framework_AbstractOrder $order) { $params = array(); $params["cart"] = $cart; $params["order"] = $order; $params["customer"] = $order->getCustomer(); $params["ordernumber"] = $order->getOrdernumber(); $mail = new \Pimcore\Mail(array("document" => $this->confirmationMail, "params" => $params)); if ($order->getCustomer()) { $mail->addTo($order->getCustomer()->getEmail()); $mail->send(); } else { Logger::err("No Customer found!"); } }