2011-04-18 71 views
0

谁能帮助我使用Drupal mimemail用于连接我使用下文提到的代码以发送特定的电子邮件附件的文件,但不知何故,它不工作,kinldy帮我在此先感谢Drupal的6 Mimemail与附件

$body = "test body with attachments"; 
    $subject = "My test message"; 

$attachments[]=array(
    'filepath' => file_directory_path().'/document.pdf', 
    'filename' => 'wonderful.pdf', 
    'filemime' => 'application/pdf', 
); 

mimemail("[email protected]", "[email protected]", $subject, $body, NULL, array(), NULL, $attachments,''); 

回答

0

我正在做一些非常相似的事情。我的代码基本上是:

$message['attachments'][] = array(
    'filepath' => $zipfilepath, 
    'filename' => 'my-attachment.zip', 
    'filemime' => 'application/zip', 
); 

从我的hook_mail模块回调中。见http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_mail/6

你确定你已经完成了以下内容:

  • 启用 “mimemail” 模块;
  • 检查管理中的选项为“对所有消息使用MIME邮件”;
  • 选择“mimemail”作为“电子邮件引擎”(在管理页面的底部)。

矿井工作得很好。我也安装了SMTP模块,并且可以将其中任一模块选作电子邮件引擎。