我在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