/*
 * 实现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;
    }
}

相关文章:

  • 2021-11-03
  • 2021-06-07
  • 2021-08-06
  • 2021-11-28
  • 2021-04-16
  • 2021-11-07
  • 2021-12-31
  • 2021-08-05
猜你喜欢
  • 2021-12-20
  • 2018-09-18
  • 2022-12-23
  • 2021-12-18
  • 2022-03-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案