<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I don't know you ''Sir'' who sent you email?!!!<BR> <BR>
<DIV>
<HR id=stopSpelling>
CC: development@drupal.org<BR>From: gene.r.clark@gmail.com<BR>Date: Sun, 29 Dec 2013 21:38:58 -0500<BR>To: development@drupal.org<BR>Subject: Re: [development] Fwd: E-mail attachments<BR><BR>
<DIV>Shut up I'm sick of your stupid emails!!!!<BR><BR>
<DIV style="FONT-FAMILY: Helvetica; FONT-SIZE: medium"><BR></DIV></DIV>
<DIV><BR>On Dec 29, 2013, at 6:47 PM, Rob Thorne <<A href="mailto:rob@torenware.com">rob@torenware.com</A>> wrote:<BR><BR></DIV>
<DIV>I don't see anything obviously wrong in your sample, but after comparing your implementation with mine from a recent project, I see a couple of differences:
<DIV><BR></DIV>
<DIV>1. You mention using the mimemail module, but are you also using the mailsystem module? The simplest explanation would be that mimemail is not getting invoked at all.</DIV>
<DIV>2. If I recall correctly, some fields you can set in the "message" array upstream can get unset before hook_mail is called for you. So you may need to put these items into your "params" array and hammer them in as part of your hook_mail implementation. My code looks like this:</DIV>
<DIV><BR></DIV>
<DIV>Sending the mail:</DIV>
<DIV><BR></DIV>
<DIV>
<BLOCKQUOTE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0px">
<DIV>
<DIV> $mail_params = array(</DIV>
<DIV> 'subject' => $settings['subject'],</DIV>
<DIV> 'message' => $settings['message'],</DIV>
<DIV> 'headers' => array(</DIV>
<DIV> 'Content-Type' => 'text/html; charset=UTF-8'</DIV>
<DIV> ),</DIV>
<DIV> 'attachments' => $attachments,</DIV>
<DIV> 'voter' => $credit_app,</DIV>
<DIV> );</DIV>
<DIV> $mail_params['plain'] = FALSE;</DIV>
<DIV> $mail_params['plaintext'] = $mail_params['message'];</DIV>
<DIV> if (!empty($settings['bcc'])) {</DIV>
<DIV> $mail_params['headers']['Bcc'] = $settings['bcc'];</DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV> $message = drupal_mail('mymodule', 'send-test', $address, $language, $mail_params, $from);</DIV></DIV>
<DIV><BR></DIV></BLOCKQUOTE></DIV>
<DIV>In my hook_mail implementation:</DIV>
<DIV><BR></DIV>
<DIV>
<BLOCKQUOTE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0px">
<DIV>
<DIV> switch ($key) {</DIV>
<DIV> case 'send-test':</DIV>
<DIV> $message['subject'] = $params['subject'];</DIV>
<DIV> $message['body'][] = $params['message'];</DIV>
<DIV> $message['headers'] = array_merge($message['headers'], $params['headers']);</DIV>
<DIV> break;</DIV>
<DIV> } </DIV></DIV>
<DIV><BR></DIV></BLOCKQUOTE></DIV>
<DIV>Note also that I'm setting some parameters that you are not setting ('plain', 'plaintext'); I believe I added those after debugging the problem you're having here.</DIV>
<DIV><BR></DIV>
<DIV>Hope this helps,</DIV>
<DIV><BR></DIV>
<DIV>Rob</DIV>
<DIV><BR>
<DIV>
<DIV>Rob Thorne</DIV>
<DIV>Torenware Networks</DIV>
<DIV><BR></DIV><BR class=ecxApple-interchange-newline></DIV><BR>
<DIV>
<DIV>On Dec 29, 2013, at 12:50 PM, Muzaffer Tolga Ozses <<A href="mailto:tolga@ozses.net">tolga@ozses.net</A>> wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: courier new,monospace" class=ecxgmail_default>Hi,<BR></DIV>
<DIV class=ecxgmail_quote>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'courier new',monospace"><BR></DIV>
<DIV style="FONT-FAMILY: 'courier new',monospace">I keep developing my module, and inside it I am sending e-mail. I am also trying to attach a file, to no avail. I have installed mimemail, I have changed mime type in my code, I have dpm'd everything. dpm gives me correct values, and the subject and body of the e-mail come through, but I couldn't get file attachment to work at all. What else can I do?</DIV>
<DIV style="FONT-FAMILY: 'courier new',monospace"><BR></DIV>
<DIV style="FONT-FAMILY: 'courier new',monospace">Regards,</DIV>
<DIV style="FONT-FAMILY: 'courier new',monospace"><BR></DIV>
<DIV style="FONT-FAMILY: 'courier new',monospace">PS: You can see the code at <A href="http://drupalcode.org/sandbox/Kartagis/1543120.git/blob/da47378:/pass2pdf.module#l69" target=_blank>http://drupalcode.org/sandbox/Kartagis/1543120.git/blob/da47378:/pass2pdf.module#l69</A></DIV></DIV></DIV><BR></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV>                                            </div></body>
</html>