Sending attachments with mimemail & webform and Drupal8

by Alexandre   Last Updated December 02, 2017 00:07 AM

I'm trying to send static attachments with webform module and mimemail.

I chose mimemail sender in webform configuration. I created a simple module to hook mail function in which I wrote this:

$attachment = array(
   'filecontent' => file_get_contents('themes/files/conditions.pdf'),
   'filename' => 'conditions.pdf',
   'filemime' => 'application/pdf',
   'filepath' => 'themes/files/conditions.pdf',
);

$message['params']['attachments'][] = $attachment;

Result: unable to send mail. I'm not sure that mimemail works fine with webform? I tried to install SwiftMailer, but no way.

Has someone an idea to resolve this issue?

Thanks

Alexander



Related Questions



First email is getting sent and others are not?

Updated February 23, 2017 13:07 PM

How to send plaintext email when mimemail is installed?

Updated February 25, 2017 18:07 PM