Page 1 of 1

MimeMail PHP sender: issue with attachments

Posted: Mon Jul 19, 2010 3:40 am
by aneuryzma
hi,

I'm using mimemail module in Drupal to send e-mails with attachments. The e-mails are correctly sent, but the attachments not. This is the code I use (I've just enabled the module):

Code: Select all

$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);

In order to be sure the path to the pdf attachment is correct I've written this line to download the attachment from browser and it works.

Code: Select all

header('Location: invoices/sample.pdf');
I've also tried absolute paths such as:
/invoices/sample.pdf
http://www.mydomain.com/invoices/sample.pdf

Also,I've tried this alternative code. But still nothing...

Code: Select all

$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. i don't think this, but is maybe because my hosting disallow to send attachments ?
thanks