Set default charset of mails to UTF-8

This commit is contained in:
Joshua Ramon Enslin 2020-10-22 14:33:14 +02:00 committed by Stefan Rohde-Enslin
parent 85c4ddeb78
commit c1778ac3a0
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 6 additions and 3 deletions

View File

@ -12,12 +12,13 @@ final class MDMailFormat {
const ACCENT_COLOR_MAIN = "#0280ee"; const ACCENT_COLOR_MAIN = "#0280ee";
const ACCENT_COLOR_SEC = "#0d5dc8"; const ACCENT_COLOR_SEC = "#0d5dc8";
const CSS_H1 = "margin: 0 0 .5em 0; padding: 0 0 .5em 0; font-size: 1.3em; font-weight: bold; border-bottom: 1px solid #D6D6D6;"; const CSS_H1 = "margin: .5em 0 .8em 0; padding: 0 0 .5em 0; font-size: 1.3em; font-weight: bold; border-bottom: 1px solid #D6D6D6;";
const CSS_H2 = "margin: .3em 0 .5em 0; padding: 0 0 0 0; font-size: 1.1em; font-weight: bold;"; 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_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_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_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_OL = "margin: 1em 0; padding: 0 0 0 1em;";
const CSS_HR = "margin: 1em 0; border-width: 0 0 0 0; border-top: 1px solid #D6D6D6;";
const CSS_A_NORMAL = "text-decoration: none;"; const CSS_A_NORMAL = "text-decoration: none;";
const CSS_A_FOOTER = "text-decoration: none; font-size: .95em;"; const CSS_A_FOOTER = "text-decoration: none; font-size: .95em;";
const CSS_A_FOOTER_HOVER = "color: " . self::ACCENT_COLOR_SEC . " !important;"; const CSS_A_FOOTER_HOVER = "color: " . self::ACCENT_COLOR_SEC . " !important;";
@ -225,7 +226,7 @@ final class MDMailFormat {
* @return void * @return void
*/ */
public function appendHr():void { public function appendHr():void {
$this->_msg_html .= "<hr />"; $this->_msg_html .= "<hr style='" . self::CSS_HR . "' />";
$this->_msg_plain .= PHP_EOL . "----------" . PHP_EOL; $this->_msg_plain .= PHP_EOL . "----------" . PHP_EOL;
} }
@ -267,13 +268,14 @@ final class MDMailFormat {
p { ' . self::CSS_P . ' } p { ' . self::CSS_P . ' }
ul { ' . self::CSS_UL . ' } ul { ' . self::CSS_UL . ' }
ol { ' . self::CSS_OL . ' } ol { ' . self::CSS_OL . ' }
hr { ' . self::CSS_HR . ' }
#footer { ' . self::CSS_FOOTER . ' } #footer { ' . self::CSS_FOOTER . ' }
#footer a { ' . self::CSS_A_FOOTER . ' } #footer a { ' . self::CSS_A_FOOTER . ' }
#footer a:hover { ' . self::CSS_A_FOOTER_HOVER . ' } #footer a:hover { ' . self::CSS_A_FOOTER_HOVER . ' }
</style> </style>
</head> </head>
<body> <body>
<div style="font-family: \'Source Sans Pro\', Roboto, arial; width: 100%; min-height: 100%; padding: 1em 0; background: #F2F2F2; color: #000; box-sizing: border-box; line-height: 1.4em;"> <div style="font-family: \'Source Sans Pro\', Roboto, arial; width: 100%; min-height: 100%; padding: 1em 0; background: #F5F5F5; color: #000; box-sizing: border-box; line-height: 1.4em;">
<div style="max-width: 600px; margin: 0 auto; padding: 1em 2em; background: #FFF; border: 1px solid #D6D6D6; box-shadow: 0 0 10px #D6D6D6;"> <div style="max-width: 600px; margin: 0 auto; padding: 1em 2em; background: #FFF; border: 1px solid #D6D6D6; box-shadow: 0 0 10px #D6D6D6;">
'; ';

View File

@ -50,6 +50,7 @@ final class MDMailerHelper {
$mail->setFrom(MD_CONF_EMAIL::SMTP_FROM, MD_CONF_EMAIL::SMTP_DISPLAYED_FROM); $mail->setFrom(MD_CONF_EMAIL::SMTP_FROM, MD_CONF_EMAIL::SMTP_DISPLAYED_FROM);
$mail->addReplyTo(MD_CONF_EMAIL::SMTP_REPLY_TO_DEFAULT); $mail->addReplyTo(MD_CONF_EMAIL::SMTP_REPLY_TO_DEFAULT);
$mail->CharSet = 'UTF-8';
return $mail; return $mail;