Mimemail:添付ファイルに関する問題
質問
MimemailモジュールをDrupalで使用して添付ファイル付きの電子メールを送信しています。電子メールは正しく送信されますが、添付ファイルはそうではありません。これは私が使用するコードです(モジュールを有効にしました):
$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。私はこれを考えていませんが、私のホスティングが添付ファイルを送ることを許可しないからかもしれません。
ありがとう 解決
MIMEメールモジュールには2つの問題報告が開かれています。
絶対ローカルパスで指定された添付ファイルはを追加していません。absoluteを使用して指定された添付ファイルが指定されています。パスは機能しません。問題を解決するための提案されたパッチがあります。その問題では、
からの添付ファイルで電子メールを送信するようにコードを変更することをお勧めします。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);
.
in real="nofollow noreferrer"> Mimemail + SMTP +添付ファイル添付ファイルの使用ではない、添付ファイルが表示されていないOPレポートSMTPを使用するとき。同じレポートでは、他のユーザーがSMTPを使用していないことを報告しますが、電子メールがルールを介して送信されたときに添付ファイルは表示されません。
所属していません StackOverflow