Php Drupal 8系统邮件中的HTML正文
我试图在输入新用户时格式化Drupal通过html发送的电子邮件。事情似乎比预期的要困难,我尝试使用Php Drupal 8系统邮件中的HTML正文,php,drupal,drupal-8,Php,Drupal,Drupal 8,我试图在输入新用户时格式化Drupal通过html发送的电子邮件。事情似乎比预期的要困难,我尝试使用hook\u mail\u alter功能,但没有成功。每次我插入HTML标记时,这些标记都会进行转换,如下例所示 如何解决这个问题?是否可以在不添加模块的情况下解决问题 function importuser_mail_alter(&$message) { switch ($message['key']) { case 'register_admin_create
hook\u mail\u alter
功能,但没有成功。每次我插入HTML标记时,这些标记都会进行转换,如下例所示
如何解决这个问题?是否可以在不添加模块的情况下解决问题
function importuser_mail_alter(&$message) {
switch ($message['key']) {
case 'register_admin_created':
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8;';
foreach ($message['body'] as $key => &$body) {
$body = new Drupal\Component\Render\FormattableMarkup($body, []);
}
break;
}
}
系统中的电子邮件为:
<strong>Gentile Utente,</strong>
Un amministratore ha creato il tuo profilo utente sul sito DEV. Puoi
autenticarti con un clic su questo collegamento oppure copiando ed incollando
il collegamento nel tuo browser: [...]
*Gentile Utente,*
Un amministratore ha creato il tuo profilo utente sul sito DEV. Puoi
autenticarti con un clic su questo collegamento oppure copiando ed incollando
il collegamento nel tuo browser: [...]