From 85c4ddeb78b0e7899d33fa7157bfde67bf5d76c5 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 22 Oct 2020 14:02:01 +0200 Subject: [PATCH] Add some more functions for adding specific elements to mails --- src/MDMailFormat.php | 59 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/src/MDMailFormat.php b/src/MDMailFormat.php index e3c5c9c..21c70d6 100644 --- a/src/MDMailFormat.php +++ b/src/MDMailFormat.php @@ -16,6 +16,8 @@ final class MDMailFormat { const CSS_H2 = "margin: .3em 0 .5em 0; padding: 0 0 0 0; font-size: 1.1em; font-weight: bold;"; const CSS_P = "margin: 0 0 0 0; padding: .4em 0 .6em 0; font-style: normal;"; const CSS_FOOTER = "margin-top: .5em; padding-top: .5em; border-top: .1em solid #D6D6D6;"; + const CSS_UL = "margin: 1em 0; padding: 0 0 0 1em; list-style: square;"; + const CSS_OL = "margin: 1em 0; padding: 0 0 0 1em;"; const CSS_A_NORMAL = "text-decoration: none;"; const CSS_A_FOOTER = "text-decoration: none; font-size: .95em;"; const CSS_A_FOOTER_HOVER = "color: " . self::ACCENT_COLOR_SEC . " !important;"; @@ -42,6 +44,8 @@ final class MDMailFormat { */ public function appendHeadline(string $input):void { + $input = trim($input); + $this->_msg_html .= "

" . nl2br($input) . "

"; $this->_msg_plain .= "{$input} =================== @@ -58,6 +62,8 @@ final class MDMailFormat { */ public function appendHeadlineSec(string $input):void { + $input = trim($input); + $this->_msg_html .= "

" . nl2br($input) . "

"; $this->_msg_plain .= "{$input} ------------------- @@ -74,6 +80,8 @@ final class MDMailFormat { */ public function appendParagraph(string $input):void { + $input = trim($input); + $this->_msg_html .= "

" . nl2br($input) . "

"; $this->_msg_plain .= " {$input} @@ -91,6 +99,8 @@ final class MDMailFormat { */ public function appendButton(string $href, string $input):void { + $input = trim($input); + $this->_msg_html .= "" . nl2br($input) . ""; $this->_msg_plain .= " {$input}: {$href} @@ -108,6 +118,8 @@ final class MDMailFormat { */ public function appendLink(string $href, string $input):void { + $input = trim($input); + $this->_msg_html .= "" . nl2br($input) . ""; $this->_msg_plain .= "{$input}: {$href}"; @@ -119,7 +131,7 @@ final class MDMailFormat { * @return void */ public function startUl():void { - $this->_msg_html .= "