Email Management and objects
  1. When the Email Management service starts, is started up it creates a Sage CRM Object and logs in to Sage CRM using registry entries.
  2. Using the Sage CRM Object, the Email Management service queries the custom_emailaddress table. This table holds information about each service for the install.
  3. The data is read in and the specified Script file is read in. Another Sage CRM Object is created and logged onto using the Sage CRM User logon ID. Using the email account information, the mailbox is logged onto and the emails are read. An interface object to the email is created. This is called the MsgHandler Object.
  4. Using the From address in the email, the database is queried to:
    • Check if the email belongs to a user. A UserQuery CRM Query Object is created, which runs the following script.
      Copy
      SELECT * FROM vUsers WHERE user_emailaddress = FromAddress 
      OR user_mobileemail = FromAddress
    • Check if the email belongs to a company. A CompanyQuery CRM Query Object is created, which runs the following script.
      Copy
      SELECT * FROM vCompanyEmail WHERE elink_recordid = comp_companyid AND emai_Emailaddress = FromAddress
    • Check if the email belongs to a person. A PersonQuery CRM Query Object is created, which runs the following script.
      Copy
      SELECT * FROM vPersonEmail WHERE elink_recordid = pers_Personid AND emai_emailaddress = FromAddress
  5. All the Objects mentioned are passed into the script context and the specified actions are performed.