drupal_mail()에 문제가 있습니다. 이메일을 받았지만 제목과 본문이 비어 있습니다.Drupal_mail() 비어있는 본문 및 제목 없음
$params = array(
'subject' => t('Client Requests Quote'),
'body' => t("Body of the email goes here"),
);
drupal_mail("samplemail", "samplemail_html_mail", "[email protected]", language_default(), $params, "[email protected]", TRUE);
아래
드루팔 버전 7
코드가 난 아래 훅을 시도하고 난 같은 결과를 얻을.
function hook_mail($key, &$message, $params) {
switch ($key) {
case 'samplemail_html_mail':
/*
* Emails with this key will be HTML emails,
* we therefore cannot use drupal default headers, but set our own headers
*/
/*
* $vars required even if not used to get $language in there since t takes in: t($string, $args = array(), $langcode = NULL) */
$message['subject'] = t($params['subject'], $var, $language->language);
/* the email body is here, inside the $message array */
$body = "<html><body>
<h2>HTML Email Sample with Drupal</h2>
<hr /><br /><br />
{$params['body']}
</body></html>";
$message['body'][] = $body;
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
break;
}
}
drupal_mail_system() 작동하지만 일반 텍스트로 제공됩니다.
'hook'을 모듈 이름으로 바꾸어야합니다. 예 : 'function mymodule_mail (' – jantimon
여전히 작동하지 않습니다. 같은 문제입니다. 본문이나 제목이 없습니다. – user742736