我在Drupal中使用mimemail模块发送附件的电子邮件。电子邮件正确发送,但附件不正确。这是我使用的代码(我刚刚启用的模块):MimeMail:与附件问题
$sender = '[email protected]';
$recipient = '[email protected]';
$subject = 'New order';
$body = 'Please, see the attachment.';
$plaintext = TRUE;
$headers = array();
$attachments[]=array(
'filepath' => 'invoices/sample.pdf',
'filemime' => 'application/pdf',
);
mimemail($sender, $recipient, $subject, $body, $plaintext, $headers, $text = NULL, $attachments, $mailkey);
为了确保路径到PDF格式的附件是正确的,我写这条线从下载浏览器,附件作品。
header('Location: invoices/sample.pdf');
此外,我试过这个替代代码。但仍然没有...
$file = new stdClass();
$file->filename = 'sample.pdf';
$file->filepath = 'invoices/sample.pdf';
$file->filemime = 'application/pdf';
mimemail($sender, $recipient, $subject, $body, $plaintext, $headers, $text = NULL, array($file), $mailkey);
ps。我不这么认为,但也许是因为我的主机不允许发送附件? 谢谢
您是否尝试过使用绝对文件路径而不是'invoices/sample.pdf'? – 2010-07-18 17:46:23
是的,我已经尝试了所有可能的路径...我的网站/发票的根...也是完整的一个http://www.domain.com/invoices ...是$附件很好地声明和传递给milemail功能?我真的被困在这,argh – aneuryzm 2010-07-18 20:35:51