나는 swiftmailer를 사용하여 Drupal 8 사이트에서 내 연락처 전자 메일을 테마로 사용하려고하지만 몇 가지 어려움이 있습니다. swiftmailer의 기본 테마 파일을 사용하려고하지만 모두 렌더링합니다. 몸. 개별적으로 각 필드에 액세스하려면 어떻게합니까?테마 문제 Drupal 8 + SwiftMailer 연락처 이메일
{#
/**
* @file
* The default template file for e-mails.
*
* Available variables:
* - subject: The subject.
* - body: The message content.
* - message: The $message array created and used in the mail building
* procedure. Its content varies between cases, but typically contains at
* least the following elements:
* - id: The message identifier.
* - module: The module that handles the building of the message.
* - key: The key of the message.
* - to: The recipient email address.
* - from: The email address of the sender.
* - langcode: The langcode to use to compose the e-mail.
* - params: The message parameters.
*
* This template may be overriden by module and/or mail key, using any of the
* following template names:
* - swiftmailer.html.twig: global, used by default.
* - swiftmailer--mymodule.html.twig: only emails sent by the module "mymodule".
* - swiftmailer--mymodule--test.html.twig: only emails by the module
* "mymodule" with key "test".
*
* @see template_preprocess()
* @see template_preprocess_swiftmailer()
*
* @ingroup themeable
*/
#}
<html>
<head>
<style type="text/css">
table tr td {
font-family: Arial;
font-size: 12px;
}
td .field {
width: 50px;
}
</style>
</head>
<body>
<div>
<table width="800px" cellpadding="0" cellspacing="0">
<tr>
<td class="field">Nome</td>
<td>{{ body.name }}</td>
</tr>
<tr>
<td class="field">Email</td>
<td>{{ body.mail }}</td>
</tr>
<tr>
<td class="field">Motivo</td>
<td>{{ body.motivo }}</td>
</tr>
<tr>
<td class="field">Titulo</td>
<td>{{ body.subject }}</td>
</tr>
<tr>
<td class="field">Mensagem</td>
<td>{{ body.message }}</td>
</tr>
</table>
</div>
</body>
</html>
그것은 간단 뭔가 보이지만 너무 많은 시간을 복용 : 내가 원하는 무엇
이 같은 것입니다. 모든 "body.something"은 비어 있습니다. 이메일에 대한
감사
덤프 (몸)은 일하고 있지만 실제로 관심이 없습니다. dump (message.params)는 아무것도 표시하지 않습니다. –