我正在尝试发送一封指定发件人的电子邮件。相反,我得到了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()
,所以您不必直接使用它。