Alert or Process when an Email to or from a Contact using BCC to Sugar when the email address is not in Contacts Module?

We have an "automatic" BCC to our SugarOnDemand installation for all email sent by our Sales and Service Personnel.  We also have an automatic redirect of inbound email from the email server to some "generic" email addresses using the Sugar BCC address.  It works well to capture all the inbound emails to some "generic" addresses (like Sales and Service) and all outbound email from Sales Reps and Service Personnel.

I'm looking for a way to set an alert in the BPM when an email from a customer or prospect is received (or a sales reps outbound email) arrives to or from an email address that isn't in the Contacts Module.

I realize that the email module in Sugar is very limited (some of us would like to have it in Studio and more functionality in BPM)...

Does anyone have a suggestion?  Thanks. 

  • Hello Bud
    Unfortunately, you can't do this by BPM. Nevertheless, this can be done by adding a custom trigger on "new e-mail was saved."

    After an email is saved in Sugar DB, check FROM, TO, and CC addresses with contacts' e-mail addresses.

    If a new one is found, create a Contact based on an e-mail's domain. It presupposes to look for accounts based on the domain addresses. If an Account already exists, add a Contact to this Account and assign it to an Account's Assign_to user. Otherwise, create the only Contact and set it to a user by specific logic. As soon as a new Contact is assigned to a user, this user will receive a notification about this (standard Sugar functionality)

    We do very similar operations when processing a list of leads after a webinar. To make the looking for of accounts quicker, we added the new custom module Domains.

    Logic Builder can configure necessary logic without programming. It opens an opportunity to change business logic as quickly as you need it.

    I hope it helps you. If you need help, let me or know.

    We make work in Sugar
    more convenient and efficient

  • @Mykola_Bulava has a good solution though I can see how one might not want to automatically create Accounts/Contacts/Prospects.

    If you don't want to automatically create Account and Contact records you could use Cases for the inbound email by assigning each of the bulk inbound email address to inbound email records related to your Sales and Service teams for processing and reassignment.

    The Case will be automatically related to that inbound Email so your Users can get to the context of the enquiry quickly and be able to create a Contact/Prospect if one does not already exist.

    The caveat with that is that Cases are assigned more or less randomly within the team. I have requested before that Sugar allow Cases to remain UNASSIGNED, by default, but this is not an option right now.

    One way around that, which is a bit of a pain, is to create a separate team for Inbound_Assignment with no one in it other than the SugarAdmin user. Associate the inbound_email records for your Bcc emails to that Team, then, in an on relate logic hook, if the Email is related to a Case that belongs to that Inbound_Assignment Team (and therefore assigned to SugarAdmin), re-assign the Case to the "From" user from your email record and change the Team on the Case to that User's primary Team. You user will now have an assigned Case for the email they received from the customer.

    As for the outbound emails, when an email record is created you can have a logic hook that verifies whether that email is outbound and has a To address that is related to a Contact/Prospect (check the email_addr_bean_rel table) if not, then look up the From address for that email by email_id in emails_email_addr_rel and see who sent it, it should be your user. You can then use MailerFactory to send an email to your user and notify them that they sent to an address not in Sugar and they should add a Contact/Prospect. Because you have access to the original email they sent you can include a link to that Email in Sugar and/or include some content in your mailer to give them an indication of which outbound email triggered the alert.

    If you don't want to send immediate notification, and/or you want to remind people that they have outstanding contacts/prospects to add, you could have a custom scheduler at the end of the day that looks up all the orphan email addresses in outbound emails (emails.type = 'out'), tracks down the senders using the corresponding entries in the emails_email_addr_rel table and notifies them, again using the MailerFactory, with a list of emails they sent for which no recipient Contact/Prospect record exists (checking email_addr_bean_rel). Include the subject line of their original email, and the To address, in your notification so the user can quickly see what they were about and add those Contact/Prospect records.

    You could do a similar check for Cases that may remain unlinked to Contacts/Prospects.

    The scheduler could become nagging after a while if you keep telling them about the same addresses and they keep ignoring them, but that might be just what you need to get them to add the Contact/Prospect record since once they do they won't have that notification again.

    You could even add a notification to the manager of users who have outstanding records to create for more than x-days/weeks.

    Alternatively you could decide to put a limit on your notification period: if the customer has not responded to the email, and the user has not added a Contact/Prospect for more than x days, then maybe you shouldn't add a record at all... so you just ignore it.

    I hope this gives you some ideas/options,


  • Thanks Mykola,

    I've been looking at the Logic Builder in relation to other things I'd like to accomplish but we're not ready to make that investment.

    Bud Hartley | Oregon, USA

  • Thanks Francesca,

    I "hijacked" the Cases Module in 2014 to be my "Purchasing" module - we don't have a need for the original intent of Cases...

    I'm not looking to automatically create Contact Records - only have a way of finding email addresses in email that is archived in Sugar through the BCC address.

    Bud Hartley | Oregon, USA

  • I would suggest a custom scheduler, it should be fairly easy to build.

    I am curious about your Bcc to the alias and how you set that up, can you share that information?

  • Hi Francesca,

    Sure! Our email server is hosted at Rackspace.  For emails sent to selected addresses (Like "Sales" or "Service") we have the inbound email automatically copied to the Sugar Archiving email address on Rackspace.

    I have fictitious Sugar users set up with those email addresses so the email arrives assigned to those users.  Employees watch the email module while filtering on those assigned to those fictitious users.  They reassign the email to the user that should handle it.

    Yes, I could have a round robin or automatic assignment process, but they are assigned based on the content and the employee availability that day.

    I have a process that sends an email with a link to the user that's assigned to handle the inbound request (instead of using the "notify on assignment" option).

    Bud Hartley | Oregon, USA

  • Your Sales and Service dummy users take up 2 licenses, that's expensive! You don't need to do that.

    You can get away with just setting up those "Sales" and "Service" as inbound emails without having them become Cases. They are still processed by Sugar, and turned into records in your "Emails" module.

    You can assign them a special "Processing Team", just by choosing the team on the inbound email record. The Team could be a filter for processing, but you could also add your email-watchers to the "Processing Team" and assign emails round-robin for processing.
    The processing person can then reassign each email to the pertinent people based on your criteria. 

    Your automated process that sends the notification to the user could also change the Team on the Email record from the "Processing Team" to "Sales Team" or "Service Team" if the system does not do that automatically when the Email is assigned. (for us everything is Global so I don't deal w/ teams much at all, not in the context of visibility)

    I have some inbound-email addresses which our sysadmins duplicate and send to a Sugar address defined in the "Inbound Email" module, I then have a scheduler that processes that mailbox, creates leads for our Sales team and links the email record to that lead record.
    Someone then reviews and assigns those "Leads".
    Because we have everything and everyone as Global we don't need to bother with changing Teams.

    I just had not thought of copying outbound email, I'll need to give that some more thought since we won't want everything that goes out of people's addresses to be logged in Sugar... food for thought.

  • Hi Bud,

    Not to hijack this thread, but I am a partner in a company in Denmark with offices around the world. We decided to use SugarCRM a couple of years back and kept running into issues like the one you are describing here. We then found the Logic Builder package from Integros, and while we have purchased other fantastic modules for Sugar, this has by far been the best investment we have made (and I am not receiving any discounts or special favors here :-)). We have been able to automate invoicing processes, change management processes and many more and currently we have internally developed more than 50 different logic flows on our Sugar Install. It has completely changed how we are able to get much more streamlined processes, and my employee working on this is able to build in a short time almost whatever I request - and he is certainly not a developer. I just wanted to share my excitement over the tool, the return on investment for us has been measured in weeks - not months or years.

    Thank you and sorry if this was not relevant.


    Rene Munk Joergensen

    Partner, Logis Solutions

  • Thanks Rene,

    Maybe I should take a closer look into Logic Builder. I've been looking at it in relation to other things I'd like to accomplish, and maybe we should invest in the product.

    Bud Hartley | Oregon, USA

  • Hi 

    To save your time, I would suggest attending our webinar on Feb 18th (early evening for Europe and morning time for the US)
    My teammate will show how to automate CRM operations by a trigger, by schedule, or inside a SugarBPM workflow:

    • Automate calculations of any complexity
    • Set up intelligent data sharing & update
    • Provide smart data validation & input control
    • Compose CRM data into an informative and easy-to-read text for emails, messages, or notes
    • Ensure data exchange by REST API and not only
    • Add to your CRM the power of AWS

    You may join the webinar here: "How to create hooks and get the best of Sugar not being a developer".

    Best Regards,
    Dmytro Chupylka
    We make work in Sugar CRM system faster, more convenient and efficient