简介:这是Drupal6 hook_mail实现发送HTML邮件的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。
class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=341729' scrolling='no'>/*
* 实现hook_mail
* $key 用于区分邮件操作
* $message 邮件内容
* $params 参数,如果有的话...
* 调用方法:drupal_mail('example', 'html', 'example@gmail.com', language_default(), array('subject' => '', 'body' => ''))
*/
function example_mail($key, &$message, $params) {
switch($key) {
case 'html':
$message['subject'] = $params['subject'];
$message['body'][] = $params['body'];
$message['headers'] = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal',
'From' => isset($params['from']) ? $params['from'] : variable_get('site_name', 'Infinity')
);
break;
}
}
* 实现hook_mail
* $key 用于区分邮件操作
* $message 邮件内容
* $params 参数,如果有的话...
* 调用方法:drupal_mail('example', 'html', 'example@gmail.com', language_default(), array('subject' => '', 'body' => ''))
*/
function example_mail($key, &$message, $params) {
switch($key) {
case 'html':
$message['subject'] = $params['subject'];
$message['body'][] = $params['body'];
$message['headers'] = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal',
'From' => isset($params['from']) ? $params['from'] : variable_get('site_name', 'Infinity')
);
break;
}
}