I don't know you ''Sir'' who sent you email?!!!
 


CC: development@drupal.org
From: gene.r.cl...@gmail.com
Date: Sun, 29 Dec 2013 21:38:58 -0500
To: development@drupal.org
Subject: Re: [development] Fwd: E-mail attachments


Shut up I'm sick of your stupid emails!!!!





On Dec 29, 2013, at 6:47 PM, Rob Thorne <r...@torenware.com> wrote:


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: 


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.
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:


Sending the mail:





  $mail_params = array(
    'subject' => $settings['subject'],
    'message' => $settings['message'],
    'headers' => array(
      'Content-Type' => 'text/html; charset=UTF-8'
    ),
    'attachments' => $attachments,
    'voter' => $credit_app,
  );
  $mail_params['plain'] = FALSE;
  $mail_params['plaintext'] = $mail_params['message'];
  if (!empty($settings['bcc'])) {
    $mail_params['headers']['Bcc'] = $settings['bcc'];
  }
  
  $message = drupal_mail('mymodule', 'send-test', $address, $language, 
$mail_params, $from);


In my hook_mail implementation:





  switch ($key) {
    case 'send-test':
      $message['subject'] = $params['subject'];
      $message['body'][] = $params['message'];
      $message['headers'] = array_merge($message['headers'], 
$params['headers']);
      break;
  }  


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.


Hope this helps,


Rob



Rob Thorne
Torenware Networks




On Dec 29, 2013, at 12:50 PM, Muzaffer Tolga Ozses <to...@ozses.net> wrote:


Hi,





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?


Regards,


PS: You can see the code at 
http://drupalcode.org/sandbox/Kartagis/1543120.git/blob/da47378:/pass2pdf.module#l69

                                          

Reply via email to