Create lead from incmoing email

Hello Friends,

I am trying to develop one functionality of creating lead from incoming emails.

I am aware about to create lead from email from email module. But it requires manual process.

Do you have any idea or suggestions that how i can achieve this functionality.

Thanks in Advance!!

i have never work with email module… but for other modules :

  • create before_save logic hook for email module
  • check if it’s new record
  • if new create a lead.

if (!isset($bean->fetched_row['id']))
    //new record
   $bean = BeanFactory::newBean('Leads');
   $bean->blaba = ''blabla;
    //existing record

The problem for me is how determine first_name, last_name…
for this you need to make and var_dump($this) in email module for see witch variable contain the appropriate value.
Or look in email module file for see how is.


1 Like

Hi Friend,

Thanks for the reply.

I have solution to crawl first name, last name from email as below:

$pattern = ‘~(?P<first_name>[\w\d.-]+)\s*(?P<last_name>[\w\d.-]+)’. ‘\s*<(?P<email_box>[\w\d.-]+@[\w\d.-]+)>~’;
preg_match( $pattern, $result[ ‘from_addr’ ], $matches );

I will try by using logic hook and will get back to you.



look this

I am too interested for this.
Just to know, before create a new Leads, we must query the database for not duplicate.
And relate contact/lead to the inbound mail.

I thinks, this must be a core implementation in suitecrm … with some config variable like this :

createBeanForInboundMail = yes/no
createBeanModuleForInboundMail = Leads/Contacts


This is going to be possible from this product.
Not just creating leads or anything from your inbound emails , user can configure parsing rules as well.

Related product