blog->name) . '', 'Content-Type: text/HTML; charset=UTF-8;' . 'X-Originating-IP: ' . http::realIP(), 'X-Mailer: Dotclear', 'X-Blog-Id: ' . mail::B64Header(dcCore::app()->blog->id), 'X-Blog-Name: ' . mail::B64Header(dcCore::app()->blog->name), 'X-Blog-Url: ' . mail::B64Header(dcCore::app()->blog->url), ]; self::$active_headers = !empty($_POST['active_headers']); self::$mail_to = $_POST['mail_to'] ?? ''; self::$mail_subject = $_POST['mail_subject'] ?? ''; self::$mail_content = $_POST['mail_content'] ?? ''; if (!empty(self::$mail_content) || !empty(self::$mail_to)) { try { if (!text::isEmail(self::$mail_to)) { throw new Exception(__('You must provide a valid email address.')); } if (self::$mail_content == '') { throw new Exception(__('You must provide a content.')); } $mail_subject = mail::B64Header(self::$mail_subject); if ($active_headers) { mail::sendMail(self::$mail_to, $mail_subject, self::$mail_content, $headers); } else { mail::sendMail(self::$mail_to, $mail_subject, self::$mail_content); } dcAdminNotices::addSuccessNotice(__('Mail successuffly sent.')); dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__NAMESPACE__)); return true; } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } return null; } public static function render(): void { echo '' . __('Mail test') . '' . dcPage::breadcrumb([__('System') => '', __('Mail test') => '']) . dcPage::notices() . '

' . __('Content:') . '

' . form::textarea('mail_content', 50, 7, html::escapeHTML($mail_content)) . '

' . ' ' . dcCore::app()->formNonce() . '

' . '
'; } }