Drupal 6邮件发件人设置为';无人';即使';来自';是指定的


Drupal 6 mail sender is set to 'Nobody' even though 'from' is specified

我正在尝试发送一封指定发件人的电子邮件。相反,我得到了Nobody@host.edu

$test='example body'.$random_String;
$message3 = array(
  'to' => 'fake_user@place.com',
  'from' => 'fake_sender@place.edu',
  //'from' => variable_get('site_mail', 'admin@example.com'), //alternative doesn't work either
  'subject' => t('Example subject'),
  'body' => $test,
  'headers' => array(),
);
drupal_mail_send($message3);

只需使用好的旧php mail()函数http://www.php.net/manual/en/function.mail.php

阅读drupal_mail_send()函数的文档。您没有为drupal_mail_send()提供正确的参数。您缺少id密钥。另外,这个函数已经使用了PHP的mail(),所以您不必直接使用它。