这是我的代码:
$params['subject'] = "Subject";
$params['body'] = "Test";
$message = drupal_mail('somemodule', 'some_mail_key', "test@gmail.com", language_default(), $params, "test12@gmail.com", TRUE);
问题是:
我收到了电子邮件,但正文和主题都是空白的。我做错了什么?
答案 0 :(得分:0)
根据documentation,$params
和$message
(你可以在哪里设置主题/正文)不是一回事。从那里的评论中,你会想要这些内容:
$params = [];
$message = drupal_mail('somemodule', 'some_mail_key', "test@gmail.com", language_default(), $params, "test12@gmail.com", TRUE);
$message['subject'] = 'Subject';
$message['body'] = array('Test');
$system = drupal_mail_system('somemodule', 'some_mail_key');
$message = $system->format($message);
$message['result'] = $system->mail($message);