I installed and adapted this module and so far everything is all right except one tiny little thing: I get the emails (i sent do my second mail adresse) always twice.

As I did not hack anything or installed anything extraordinary I was wondering what this bug could cause.

What went wrong? Is there any more information you need to help me?

Greetings from Germany!

Comments

jpitassi’s picture

I am having the same problem. Also when I add a message it prints the message twice on the emails.

bitsantos’s picture

I experience the same as #2. The email is sent twice and the message is printed twice in both emails.

bitsantos’s picture

I found a way to fix the double-messages. In /send/theme/send.theme.inc, lines 127-129, (6.x-1.0-alpha4) replace:

      if (isset($data['content'])) {
         $content .= $values[$name] = $data['content'];
      }

With:

      if (isset($data['content'])) {
        $values[$name] = $data['content'];
        if($name != "message") $content .= $data['content'];
      }

Not sure how this would affect any future modules that use the Send API but it works for the Send Node module.

bitsantos’s picture

Found a workaround for the double-sending. It turns out that at some point the recipient gets doubled in the recipient array.

Just put this in at line 334 of send/includes/handlers/send.inc:

    $emails = array();
    foreach ($recipients as $r) {
      if(in_array($r['mail'], $emails)) { continue; } else { $emails[] = $r['mail']; }

Basically makes the loop skip the current email recipient if the message has already been sent to him.

I'm sure the root cause of the double-recipients is somewhere else but in the interest of time, I'm sticking to this solution for now. :)

voodoo171’s picture

Could you tell me something more about this solution? i tried implementing it, but i get an error :
Parse error: syntax error, unexpected T_PUBLIC in /home/users/***/sites/all/modules/send/includes/handlers/send.inc on line 338, if i replace whole section from foreach. It always makes an error with the nex "public function". I would realy appreciate some help on this. Thanks !

MickC’s picture

like this

    $emails = array();
    foreach ($recipients as $r) {
      if(in_array($r['mail'], $emails)) { continue; } else { $emails[] = $r['mail']; 
      $r = (object) $r;
      $r_mode = (isset($r->mode)) ? $r->mode : $mode;
      }
HTF’s picture

I also have this problem

dan3h’s picture

Thanks, @bitsantos. Your fixes in #3 and #4 worked for me. I was also getting the message twice, and each message containing the body twice.

allie micka’s picture

Category: support » bug
Status: Active » Fixed

Committed a fix.

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.