Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
drupal Webform HTML电子邮件挂钩_Html_Email_Drupal_Hook_Drupal Webform - Fatal编程技术网

drupal Webform HTML电子邮件挂钩

drupal Webform HTML电子邮件挂钩,html,email,drupal,hook,drupal-webform,Html,Email,Drupal,Hook,Drupal Webform,我正在尝试向提交HTML表单的用户发送一封感谢电子邮件。 通过在template.php文件中使用钩子,我发现这样可以正确设置头: function mythemename_webform_mail_headers($form_values, $node, $sid) { $headers = array( 'Content-Type' => 'text/html; charset=UTF-8; format=flowed; delsp=yes', 'X-Mailer

我正在尝试向提交HTML表单的用户发送一封感谢电子邮件。 通过在template.php文件中使用钩子,我发现这样可以正确设置头:

function mythemename_webform_mail_headers($form_values, $node, $sid) {
  $headers = array(
    'Content-Type'  => 'text/html; charset=UTF-8; format=flowed; delsp=yes',
    'X-Mailer'      => 'Drupal Webform (PHP/'. phpversion() .')',
  );

  return $headers;
} 
这是弗雷特的“谢谢”邮件。 站点管理员通过表单结果收到的电子邮件也是html,但它不会将此电子邮件中的换行符转换为换行符。我不知道如何使用钩子来实现此目的,因此我必须编辑webform.module文件并执行以下操作:

function webform_mail($key, &$message, $params) {
  $message['headers'] = array_merge($message['headers'], $params['headers']);
  $message['subject'] = $params['subject'];
  //$message['body'][] = drupal_wrap_mail($params['message']); // replaced this with line below
  $message['body'][] = nl2br(drupal_wrap_mail($params['message']));
}

这可以通过template.php中的hook来完成吗?

您可以用来编辑用创建的邮件,这是webform使用的。

您可以用来编辑用创建的邮件,这是webform使用的。您不能在主题中使用hook\u mail\u alter(),只能在自定义模块中使用。

您不能在主题中使用hook\u mail\u alter(),仅在自定义模块中。

旧主题,但我想仍然有用。在webform模块的编辑页面上,有一个带有附加处理的选项/字段集:

<?php
$to = $form_values['submitted_tree']['uw_gegevens']['e_mail'];
$from = "no-reply@example.com";
$achternaam = $form_values['submitted_tree']['uw_gegevens']['uw_naam'];


$message = drupal_mail('webform_extra', 'reply', $to, language_default(), array('body' => $body), $from, TRUE);

function webform_extra_mail($key, &$message, $params) {
  $message['subject'] = "TEXT.";


  $message['body'] = "
TEXT, " . $params['achternaam'] . "
TEXT. 


KIND REGARDS,
TEXT
";


} ?>

希望这有帮助


Guus van de Wal

这是一个老话题,但我想还是有用的。在webform模块的编辑页面上,有一个带有附加处理的选项/字段集:

<?php
$to = $form_values['submitted_tree']['uw_gegevens']['e_mail'];
$from = "no-reply@example.com";
$achternaam = $form_values['submitted_tree']['uw_gegevens']['uw_naam'];


$message = drupal_mail('webform_extra', 'reply', $to, language_default(), array('body' => $body), $from, TRUE);

function webform_extra_mail($key, &$message, $params) {
  $message['subject'] = "TEXT.";


  $message['body'] = "
TEXT, " . $params['achternaam'] . "
TEXT. 


KIND REGARDS,
TEXT
";


} ?>

希望这有帮助


Guus van de Wal

我试过这个但不起作用:函数mythemename_mail_alter(&$message){if($message['id'=='webform_18'){$message['body'][]=nl2br($message['body']);}我试过这个但不起作用:函数mythemename_mail_alter(&$message if($message['id'='webform 18'){$message['body']]]=nl2br($message['body']); } }