请解释我在哪里有问题,我尝试发送电子邮件但是,它不起作用。我看到的一个错误是" 500内部服务器错误",在firebug控制台中。我使用AJAX访问执行drupal_mail(...)的函数。请帮帮我一个人解释wtf它不起作用....提前感谢。
function duels_create_duel(){
$params = array();
$params['subject'] = "Theme";
$params['message'] = "Test message";
$params['body'] = array();
$params['body'][] = "Test message1";
$params['body'][] = "Test message2";
$params['body'][] = "Test message3";
$params['headers']['MIME-Version'] = '1.0';
$params['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
$params['headers']['Content-Transfer-Encoding'] = '8Bit';
$params['headers']['X-Mailer'] = 'Drupal';
drupal_mail("duels", "duel_start_op", "viktor.s@glyanec.net", language_default(), $params);
print json_encode(1); exit;
}
duels_create_duel();
function duels_mail($key, &$message, $params){
switch($key){
case 'duel_start_op':
if (isset($params['subject'])) {
$message['subject'] = str_replace(array("\r", "\n"), '', $params['subject']);
}
if (isset($params['body'])) {
$message['body'][] = $params['body'];
}
if (isset($params['headers']) && is_array($params['headers'])) {
$message['headers'] += $params['headers'];
}
//this one i use just for checking.
mail('viktor.s@glyanec.net', 'test', "Failed"."\r\n" . print_r($message, TRUE));
break;
case 'duel_start_u':
break;
case 'duel_rejected':
break;
}
}