Add option to add logos to header in HTML mails
This commit is contained in:
@ -24,17 +24,22 @@ final class MDMailFormat {
|
||||
const CSS_A_FOOTER_HOVER = "color: " . self::ACCENT_COLOR_SEC . " !important;";
|
||||
const CSS_A_BUTTONLIKE = 'display: inline-block; width: auto;
|
||||
margin: .5em 0; padding: .6em .8em;
|
||||
font-size: inherit;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
font-size: inherit; font-weight: bold;
|
||||
border-radius: .2em; transition: border .2s;
|
||||
background: ' . self::ACCENT_COLOR_MAIN . ' !important; color: #FFF !important;
|
||||
transition: background .4s;';
|
||||
const CSS_A_BUTTONLIKE_HOVER = 'background: ' . self::ACCENT_COLOR_SEC . ' !important;';
|
||||
|
||||
const CSS_LOGO = "height: 1.5em; margin-right: .4em; vertical-align: middle;";
|
||||
const CSS_H1_SPAN = "vertical-align: middle;";
|
||||
|
||||
/** @var string */
|
||||
private string $_msg_html = "";
|
||||
/** @var string */
|
||||
private string $_msg_plain = "";
|
||||
/** @var boolean */
|
||||
public bool $use_logo = false;
|
||||
|
||||
/**
|
||||
* Function for adding a headline.
|
||||
@ -47,7 +52,9 @@ final class MDMailFormat {
|
||||
|
||||
$input = trim($input);
|
||||
|
||||
$this->_msg_html .= "<h1 style='" . self::CSS_H1 . "'>" . nl2br($input) . "</h1>";
|
||||
$this->_msg_html .= "<h1 style='" . self::CSS_H1 . "'>";
|
||||
if ($this->use_logo === true) $this->_msg_html .= "<img style='" . self::CSS_LOGO . "' src=\"cid:mdlogo\" alt='' />";
|
||||
$this->_msg_html .= "<span style='" . self::CSS_H1_SPAN . "'>" . nl2br($input) . "</span></h1>";
|
||||
$this->_msg_plain .= "{$input}
|
||||
===================
|
||||
";
|
||||
@ -272,6 +279,8 @@ final class MDMailFormat {
|
||||
#footer { ' . self::CSS_FOOTER . ' }
|
||||
#footer a { ' . self::CSS_A_FOOTER . ' }
|
||||
#footer a:hover { ' . self::CSS_A_FOOTER_HOVER . ' }
|
||||
h1 img { ' . self::CSS_LOGO . ' }
|
||||
h1 span { ' . self::CSS_H1_SPAN . ' }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
Reference in New Issue
Block a user