Managing Emails

From Opentaps Wiki
Jump to navigationJump to search

Setting up Outbound Emails

To send outgoing emails from the system, turn on your mail server by editing framework/common/config/ and setting mail.notifications.enabled=Y. You can also configure a special SMTP host, user, and password here.

Processing Inbound Emails

To process inbound e-mails with opentaps, we recommend that you set up your mail server so that all your incoming e-mails are automatically forwarded to an e-mail address, your "default CRM email listener", with their original TO and CC intact. Opentaps can then be set up to listen to that e-mail address, your "default CRM email listener", and process all of the mail coming in for opentaps users.

For example, fetchmail can relay messages from an POP/IMAP server such as dovecot to a postfix SMTP server. Here is an example for configuring your /home/opentapsmail/.fetchmailrc to relay the e-mails to a user on your server called opentapsmail:

 # for test and not delete emails from the server you can add at the end of each line
 #  keep
 # to log in the system logs just add at the beginning of the file
 #  set syslog
 poll proto pop3 user joe there with password 12345 is opentapsmail here
 poll proto pop3 user jane there with password 55645 is opentapsmail here

For more information, see configuring fetchmail.

With sendmail, you can edit /etc/mail/virtusertable and /etc/mail/aliases to alias your incoming e-mails to the opentapsmail address.

opentaps can then listen on the opentapsmail email address of your server. To set this up, edit framework/base/config/ofbiz-containers.xml and set “”, “mail.user”, “mail.pass” for “javamail-container” to your server. Both IMAP and POP3 are supported for “”. If you set “delete-mail” to true, then the messages will be deleted after they are retrieved, even if they do not match any of the MCA conditions. If you set “delete-mail” to false, then messages will be marked “seen.” If you have an IMAP server, then they won’t be downloaded the next time. If you have a POP3 server, however, “seen” is not supported, so if the messages are not deleted, they will be downloaded over and over again. Finally, the "maxSize" property is used to control the largest size of emails received. You should set it to a larger value than the default of 100000 (100 KB).

Once you have set up your listener, you need to set up a processing service for your incoming emails. This can be set up by configuring an MCA or Mail-Condition-Action in any of your applications. By default, the opentaps CRMSFA application has MCA configured to process both incoming emails and outgoing emails which are being BCC'd to a mailbox for opentaps to archive. An MCA can be configured by adding the following to your ofbiz-component.xml:

   <service-resource type="mca" loader="main" location="servicedef/smcas.xml"/>

The smcas.xml file should have a definition of how to process the incoming email, such as the following from CRMSFA:

    <mca mail-rule-name="processIncomingEmail">
        <condition-field field-name="to" operator="matches" value="(?i).*@opentaps\.org>*"/>
        <action service="crmsfa.processIncomingEmail" mode="sync"/>

Note: the (?i) makes the match case insensitive.

Note that regular expressions can be used to identify which emails should be processed by which MCA. The MCA invokes a service which must implement the mailProcessInterface to process emails. The service will be given a MimeMessageWrapper to process emails with. For more information about the default email processing in opentaps, see Handling Emails.

Archiving Outbound Emails

Once you have set up opentaps to listen on an e-mail address, you can also archive outgoing e-mails simply by putting the opentapsmail address or one of the addresses that forwards to it in the BCC of your outgoing e-mails. Then, opentaps will record these e-mails and automatically associate them with the contacts, accounts, cases, and orders that they are related to. Archived e-mails will be automatically set to complete it, so they will not show up in your pending inbound e-mails screen, but they will be visible in Activities history, and you can reply to or forward them from opentaps.

Setting up Event Notifications

Event notifications for opentaps CRM can be configured in hot-deploy/crmsfa/config/ You can configure notifications for:

  • task and event assignments
  • account and lead assignment
  • catalog request notification

In addition, you can configure notification e-mails for order and shipment-related events in the order and product applications.

User Manual page > Setup for opentaps email Handling