I'm trying to add one pdf attachment to the mail sent on webform submission. I'm using hook_mail_alter()
to add attachments to the mail.
This is the code I am using.
function webfpdf_mail_alter(&$message) { $attach = genpdf($message['params']['message']); $message['params']['attachments'][] = $attach; dpm($message); return $message; }
The output message shown by dpm()
shows attachment, but the email doesn't contain attachments.
This is the output of dpm()
.
attachments (Array, 1 element)
0 (String, 568525 characters ) Content-Type: application/pdf; name="Webform-...
Content-Type: application/pdf;
name="Webform-submission.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Webform-submission.pdf"
cSA4NS4wNCAwIDAgMzMuNzMgMjguM......
..../****base64data*****/.....
..... ;
body (Array, 1 element)
headers (Array, 7 elements)
MIME-Version (String, 3 characters ) 1.0
Content-Type (String, 24 characters ) text/html; charset=UTF-8
Content-Transfer-Encoding (String, 4 characters ) 8Bit
X-Mailer (String, 27 characters ) Drupal Webform (PHP/5.3.29)
Return-Path (String, 35 characters ) [email protected]
Sender (String, 35 characters ) [email protected]
From (String, 28 characters ) "LESS" <[email protected]>
Can anyone help me to fix this?