AnsweredAssumed Answered

How can I automatically generate a new contact from inbound emails?

Question asked by Gaelle Fernandez on Mar 27, 2014
Latest reply on Mar 26, 2015 by kumar bittu
Hello everybody!

What i have : 

Sugarcrm enterprise 6.5.14

I have set the inbound email to automatically generate cases under some conditions. (it is set in Sugar's administration > Inbound email. It's native, i didn't write any code, juste setting it up). I saw on /modules/InboundEmail/InboundEmail.php the function handleCreateCase() which i think (but please, confirm it) is used to generate cases.

What i want : 

When a case is generated by an inbound email, the function handleCreateCase() is searching for contact ids and retrieves the good contact with this id :

snippet of handleCreateCases() :

if($contactIds = $this->getRelatedId($contactAddr, 'contacts')) {
     if(!empty($contactIds) && $c->load_relationship('contacts')) {
          $c->contacts->add($contactIds);
     } // if
} // if
Now, i would like to add a "Else" condition : if there is no related contact, then create one.

My question is..

How do i code that? Could i customize the InboundEmail module? Will it be taken by Sugar?

Thanks a lot for your patience and your time.

Outcomes