From 721ac34381efcd11f5d7543a87045a3ba18d0eaa Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 27 Nov 2022 23:25:21 +0100 Subject: [PATCH] initial commit from testMail 0.1 --- _admin.php | 7 ++++ _define.php | 10 ++++++ icon.png | Bin 0 -> 452 bytes index.php | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 _admin.php create mode 100644 _define.php create mode 100644 icon.png create mode 100644 index.php diff --git a/_admin.php b/_admin.php new file mode 100644 index 0000000..5dabf3a --- /dev/null +++ b/_admin.php @@ -0,0 +1,7 @@ +addItem(__('Mail testor'), + 'plugin.php?p=testMail', + 'index.php?pf=testMail/icon.png', + (preg_match('/plugin.php\?p=testMail(.*)?$/',$_SERVER['REQUEST_URI'])), + $core->auth->isSuperAdmin()); +?> \ No newline at end of file diff --git a/_define.php b/_define.php new file mode 100644 index 0000000..fcdfade --- /dev/null +++ b/_define.php @@ -0,0 +1,10 @@ +registerModule( + /* Name */ "mailTestor", + /* Description*/ "Send a simple mail from admin", + /* Author */ "Osku and contributors", + /* Version */ '0.1' +); +?> \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..45d7f067655e815caedbff0accf14d685c0ff16c GIT binary patch literal 452 zcmV;#0XzPQP)@qr@y7eVu5YK!j_>Bbly>^dZ_LIb(`R%sMbMzs)}d8YywQe z3}ec_nD473NxU*haQ^VO*1;XvYZ+qzeIx`h-wdoJ4|}aRjwv}H98%$)1ZF*0!&>sN zH$8w0x-I0Ock!!PYSOGNxf~Eh5pOAl-iLd9hL6rk&ShYZYphvv>{Y7?vKYL*Li;yl zI4$gqIj*^SZ^f}!$*ke7HOUU|5m8t1i=dxuJdX1?vL-5@vNan z{FDjg05M+{US(~tmOQdVxd*<#`5jn-JnZG0*#GQyy|QgXISwk#CRC#VMR~balZMH3 u3Ns$Vj7EruLzpl`LOFX&|Nb|A3ormeM$bB?>xCl#0000blog->name). +'', +'Content-Type: text/HTML; charset=UTF-8;'. +'X-Originating-IP: '.http::realIP(), +'X-Mailer: Dotclear', +'X-Blog-Id: '.mail::B64Header($core->blog->id), +'X-Blog-Name: '.mail::B64Header($core->blog->name), +'X-Blog-Url: '.mail::B64Header($core->blog->url) +); + +$active_headers = empty($_POST['active_headers']) ? false : true; +$mail_to = $_POST['mail_to'] ? $_POST['mail_to'] : ''; +$mail_subject = !empty($_POST['mail_subject']) ? $_POST['mail_subject'] : ''; +$mail_content = !empty($_POST['mail_content']) ? $_POST['mail_content'] : ''; +$mail_to_send = (!empty($_POST['mail_content'])) || (!empty($_POST['mail_to'])) ? true : false; +$mail_sent = false; +if ($mail_to_send) +{ + try { + if (!text::isEmail($mail_to)) { + throw new Exception(__('You must provide a valid email address.')); + } + + if ($mail_content == '') { + throw new Exception(__('You must provide a content.')); + } + + $mail_subject = mail::B64Header($mail_subject); + + if ($active_headers) { + mail::sendMail($mail_to,$mail_subject,$mail_content,$headers); + } else { + mail::sendMail($mail_to,$mail_subject,$mail_content); + } + $mail_sent = true; + //http::redirect($p_url); + } + catch (Exception $e) + { + $core->error->add($e->getMessage()); + } +} +?> + + + + <?php echo __('Mail testor'); ?> + + +'.__('Mail testor').''; + +if ($mail_sent) { + echo '

'.__('The following mail was sent:').'

+
+

'.$mail_subject.'

' + .mailConvert::toHTML($mail_content). + '
'; +} + +echo +'
+
+

'. +'

+

'. +form::textarea('mail_content',30,7,html::escapeHTML($mail_content),'maximal'). +'

+

'. +form::checkbox('active_headers', 1, $active_headers). +' +

+

'.form::hidden(array('p'),'testMail'). +$core->formNonce(). +' +

+
+
'; +?> + +