문제

저는 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.나는 이것을 생각하지 않지만, 아마도 호스팅이 첨부 파일을 보낼 것을 허용하지 않기 때문일 수 있습니까? 감사합니다

도움이 되었습니까?

해결책

MIME 메일 모듈에 대해 두 가지 문제가 열렸습니다.

in 절대 로컬 경로로 지정된 첨부 파일은 추가되지 않습니다 가 추가되지 않고 절대 값을 사용하여 지정된 첨부 파일을보고합니다.경로가 작동하지 않습니다.문제를 해결할 수있는 제안 된 패치가 있습니다.이 문제에서

에서 첨부 파일로 이메일을 보내는 코드를 변경하는 것이 좋습니다.
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 Mimemail + SMTP + 첨부 파일 첨부 파일로 작동하지 않음 첨부 파일이 표시되지 않음SMTP를 사용할 때;동일한 보고서에서 다른 사용자가 SMTP를 사용하지 않는다고보고하지만 이메일을 규칙을 통해 전송할 때 첨부 파일이 표시되지 않습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top