Email to Activity processing: If there's a matching org contact and no matching individual, then file on the org instead of creating a new individual
Overview
Hello CiviCRM team, on the automatic creation of email activities, we are trying to find a solution for the received emails that are associated with organizations, not individuals.
The emails sent to an organization mail account are associated with a new contact of type individual
, instead of the existent contact of type organization
.
This exact same situation was raised a few years ago here: https://civicrm.stackexchange.com/questions/20200/autofiling-email-activities-via-emailprocessor-to-organization
Proposed behaviour
We would like to add the ability to save these organization emails on the expected contact. This would be configurable using a specific new setting. We would do the change on https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/Mail/Incoming.php#L450 replacing the line for something like
$cType = CRM_Core_BAO_MailSettings::defaultDAO()->save_organization_emails ? NULL : 'Individual';
$dao = CRM_Contact_BAO_Contact::matchContactOnEmail($email, $cType);
And adding the new field on MailSetting:
If you think it is an acceptable idea, we will create a PR.
Thanks!