tmsimont 在此 URL ( http://api.drupal.org/api/function/drupal_mail#comment-3243 ) 上解释说
$from 参数只会改变 From 标头,而不是 Sender、Errors-to 或 Return-Path。
由contact_mail_page_submit 使用的drupal_mail 函数。
更多细节(来自drupal_mail()
函数的代码)
line 3 - $default_from = variable_get('site_mail', ini_get('sendmail_from'));
line 9 - 'from' => isset($from) ? $from : $default_from,
line 23 - if ($default_from) {
line 24 - // To prevent e-mail from looking like spam, the addresses in the Sender and
line 25 - // Return-Path headers should have a domain authorized to use the originating
line 26 - // SMTP server. Errors-To is redundant, but shouldn't hurt.
line 27 - $headers['From'] = $headers['Sender'] = $headers['Return-Path'] = $headers['Errors-To'] = $default_from;
line 28 - }
line 29 - if ($from) {
line 30 - $headers['From'] = $from;
line 31 - }
line 32 - $message['headers'] = $headers;
因此,要解决您的问题,您可以实现 hook_mail 功能(http://drupal.org/node/358855#comment-2079266)
更多资源可以在这里找到:
1 - http://drupal.org/node/656472
2 - http://drupal.org/node/861562
3 - http://www.nmglc.co.uk/content/overriding-drupals-mail-function