Hello,

My form has 3 conditional emails and 1 confirmation email. Two of the conditional emails, those to fixed addresses, are being sent immediately instead of after the email address is confirmed. This is a major issue as we cannot then tell whether or not the email address is being confirmed from our end.

Comments

hirbys’s picture

I'm seeing what is perhaps a version of this. I have two e-mail messages associated with a form, one (call it message 'A') of type 'confirmation' and one (call it message 'B') of type 'conditional.' As with the original report of the issue, message 'B' is addressed to a fixed address, not to an address contained in a form variable. When the form is submitted, both A and B are sent, rather than B waiting until the email address has been confirmed. Assuming my setup is correct, this seems to be a bug.

fbo’s picture

Solution (strongly non-elegant would like to get back to this later):

webform_confirm_email.module:

function webform_confirm_email_get_email_info($message) {
  
    $obj = db_fetch_object(db_query('select email_type, e.eid from {webform_submitted_data} as s join ({webform_confirm_email} as c, {webform_emails} as e) on (s.cid=e.email and s.nid = e.nid and c.nid = s.nid and c.eid = e.eid) where s.nid = %d and sid = %d and data = "%s" and (subject = "%s" or subject = "default")'
    , (int)($message['params']['node']->nid)
    , (int)($message['params']['submission']->sid)
    , $message['to'], $message['subject']));

    #FBO hack start
  if($obj->email_type)return array(($obj->email_type), (int)($obj->eid));
  $mailarr=$message['params']['node']->webform['emails'];
  foreach($mailarr as $mailing){
    if ($mailing['email']==$message['to'])$eid=$mailing['eid'];
  }
  if($eid){
    $obj = db_fetch_object(db_query("select email_type from webform_confirm_email where eid=$eid AND nid=".$message['params']['node']->nid));
    return array($obj->email_type, $eid);
  }else{
    return FALSE;
  }
    #FBO hack end
}
mattferris’s picture

Status: Active » Needs review
StatusFileSize
new1.08 KB

I've encountered the same problem, but believe it's just a bug in the SQL query in webform_confirm_email_get_email_info() function as seen in fbo's post. I removed the "s.cid=e.email" join condition and things seem to work. I've included a patch with the changes.

matthias_mo’s picture

Status: Needs review » Closed (fixed)

please get the latest git version that should fix the problem.