3

If I import contacts via a CSV file and indicate a home email, the email address does get imported without any issue.

However, in order to send an email to the contact (in my case sending to an entire group in CiviMail), I currently need to open the contact and select "Add or edit email", and re-save it in order for it to be active.

Once it is active (which can be determined when the field label "Home Email" is then bolded), CiviMail then recognizes the email address and can then send.

Update: I should add, this could likely be a bug since the issue is also present on the Civi demo site at https://civicrm.demo.civihosting.com

  • I just tried to do a simple import (first, last, email) into the demo site above and it worked no problem. The email address label is bolded, which I think means that email address has the is_primary field in the civicrm_email table set to 1. I'm guessing for some reason this is not getting set right for you. When you go to edit the email addresses, is the primary box checked? What is the structure of your csv file? I seemed to remember one time where the order made a difference. You might try having the email address be one of the first columns. – Paul-Tahoe Mar 14 at 1:35
  • That method only seems to work if you previously added an email address (which would have automatically saved it as "Primary"), if there was already an email address it will update and keep the field title bold because it won't affect the "is_primary" status. If you create a new contact on the demo site, just add a First Name and Last Name and leave the email field blank, then import with an address field and you should be able to replicate. – Thinkwell Mar 14 at 12:58
1

Yes it appears to be a bug. You should file one.

Here seems to be the conditions:

Importing update or fill, i.e. contact already exists Has no existing email address or any existing has is_primary flag = 0 Has a street address or are also importing one

There seems to be no way via import to fix these or to import them correct. Well, if you are also importing a street address, you can to do two imports, first just adding email address and second adding the address.

I guessing the design is for any new additional email address imports to not make them primary (makes sense) and for some reason the existence of a street address makes it think there is already an existing email address.

Here is some sql that will give you back any contacts with email addresses that don't have primary one.

select c.display_name,
       e.email,
       e.on_hold,
       e.is_primary,
       e.id eid,
       t.name,
       c.id cid,
from   civicrm_contact c,
       civicrm_email e,
       civicrm_location_type t
where  e.contact_id = c.id
and    e.location_type_id = t.id
and    not c.is_deleted
and    not exists 
       (select 'email primary'
        from   civicrm_email e2
        where  e2.contact_id = e.contact_id
        and    e2.is_primary)
order by 1
0

If you import the email address as type- Primary it will be available for mailings

  • I have tried that - mapping the email field to "Email (match to contact)" and type "Primary" still does not make the email "active" for use – Thinkwell Mar 11 at 11:04
0

Use the API Explorer to see what you have in the field "Do not email". Go to Support > Developer > API Explorer For Entity select Contact, leave Action as Get, Fields to Return select Do not Email (you can leave this blank and you will see all the fields). You can select a parameter so you get one or more of the imported contacts that is not working. Then below click Execute and you should see results. If the "Do not email" field is 0 then this will not be your problem. If it is 1 or Null then you need to add another column to your CSV file for "Do not Email" and set it to 0.

  • Unfortunately in my case "Do not email" field is "0" – Thinkwell Mar 12 at 11:21
  • I'm only assuming this could likely be a bug since it also occurs on a clean install of the Civi demo site at civicrm.demo.civihosting.com – Thinkwell Mar 12 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.