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):
$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);
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.
header('Location: invoices/sample.pdf');
Also,I've tried this alternative code. But still nothing...
$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