$query = CRM_Utils_SQL_Select::from('civicrm_email e')
->select(array('e.id', 'e.contact_id', 'e.email'))
->join('c', 'INNER JOIN civicrm_contact c ON e.contact_id = c.id')
- ->where('e.email IN (@emails)', array('@emails' => $testEmailParams['emails']))
+ ->where('LOWER(e.email) IN (@emails)', array('@emails' => $testEmailParams['emails']))
->where('e.on_hold = 0')
->where('c.is_opt_out = 0')
->where('c.do_not_email = 0')
$emailDetail = array();
// fetch contact_id and email id for all existing emails
while ($dao->fetch()) {
- $emailDetail[$dao->email] = array(
+ $emailDetail[strtolower($dao->email)] = array(
'contact_id' => $dao->contact_id,
'email_id' => $dao->id,
);