Hello,

I am trying to send a file attachment (x.pps) using the mimemail module, but I don't really know why isnt it working. Here is my code:

$att[]=array(
 'filepath' => '/home/loftyf01/public_html/newsletter/x.pps',
 'filemime' => 'application/vnd.ms-powerpoint',
);
mimemail($from, $mail, $subject, $body, FALSE, $headers = array(), $text = NULL, $att );

this isnt working either: (I've placed the file in sites/default/files/hirlevel/ too, so thats not the error I guess)

$att[0]=array(
'filepath' => file_directory_path().'/newsletter/x.pps',
'filemime' => 'application/vnd.ms-powerpoint',
);

Whats wrong with this? Should the path be relative or absolute? I've tried with both but none of them worked so far.
Thanks in advance.

Comments

sgabe’s picture

The path should be a relative Drupal path.

In your case I think:


$att[] = array(
  'filepath' => 'newsletter/x.pps',
  'filemime' => 'application/vnd.ms-powerpoint',
);

Robbert’s picture

If you really need absolute paths you may take a loot at the patch in #760080: Attachments specified with absolute local paths are not added.

simon georges’s picture

Shouldn't you add the 'list' => 1 key to the attachment table ?

sgabe’s picture

Not necessary, since there was a modification to take 'list' into account only if it is set.

sgabe’s picture

Title: Send file attachment with mimemail » Send file attachment
Status: Active » Closed (fixed)

Now I'm closing this issue, since there was some improvement in sending attachments.