1

Drupalのmimemailモジュールを使用して、添付ファイル付きの電子メールを送信しています。電子メールは正しく送信されますが、添付ファイルは送信されません。これは私が使用するコードです(モジュールを有効にしたばかりです):

$sender = 'mycompany@company.com';
$recipient = 'myemail@mail.com';
$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。私はこれを考えていませんが、おそらく私のホスティングが添付ファイルの送信を許可していないためですか?ありがとう

4

1 に答える 1

0

Mime Mail モジュールについて 2 つの問題レポートが開かれています。

絶対ローカル パスで指定された添付ファイルは追加されません。OPは、絶対パスを使用して指定された添付ファイルが機能しないことを報告します。この問題を解決するための提案されたパッチがあります。その問題では、コードを変更して添付ファイル付きの電子メールを送信することをお勧めします

header('Location: invoices/sample.pdf');

$sender = 'mycompany@company.com';
$recipient = 'myemail@email.com';
$subject = 'New order';
$body = 'Please, see the attachment.';
$plaintext = TRUE;
$headers = array();
$attachments[] = array(
  'filepath' => 'invoices/sample.pdf',
  'filemime' => 'mime/type',
);

mimemail($sender, $recipient, $subject, $body, $plaintext, $headers, $text = NULL, $attachments, $mailkey);

header('Location: invoices/sample.pdf');

$sender = 'mycompany@company.com';
$recipient = 'myemail@email.com';
$subject = 'New order';
$body = 'Please, see the attachment.';
$plaintext = TRUE;
$headers = array();
$attachments[] = array(
  'filepath' => 'invoices/sample.pdf',
  'filemime' => 'mime/type',
  'filename' => 'sample.pdf',
  'list' => TRUE,
);

mimemail($sender, $recipient, $subject, $body, $plaintext, $headers, $text = NULL, $attachments, $mailkey);

mimemail + smtp + attachments not working with attachmentsで、OP は、SMTP を使用すると添付ファイルが表示されないと報告します。同じレポートで、別のユーザーが SMTP を使用していないと報告していますが、電子メールがルール経由で送信されると添付ファイルが表示されません。

于 2010-07-20T14:51:58.510 に答える