About

The plugin allows to organize corporate Email exchange. Incoming Email messages may be processed via Message Queue. Outgoing mails are edited in processes.

Setup

Make sure the plugin is enabled and append to the configuration:

# areas to search recipient’s addresses in message editor, other possible values: users
#email:recipients.search.area=process,executors,process_customers

Message Type

Configure a message type for every mailbox, is going to be connected to the system:

messageType.<ID>.title=<TITLE>
messageType.<ID>.class=MessageTypeEmail
messageType.<ID>.email=<EMAIL>
messageType.<ID>.pswd=<IMAP_PASSWORD>
messageType.<ID>.host=<IMAP_HOST>
messageType.<ID>.mail.smtp.host=<SMTP_HOST>

# optional
# IMAP without SSL
#messageType.<ID>.store=imap
# IMAP port instead of 993 for IMAP SSL and 143 for IMAP without SSL
#messageType.<ID>.port=
# IMAP login instead of <EMAIL>
#messageType.<ID>.login=
# IMAP folder for incoming messages
#messageType.<ID>.folderIn=INBOX
# IMAP folder for processed messages
#messageType.<ID>.folderProcessed=CRM_PROCESSED
# IMAP folder for skipped with parsing error messages
#messageType.<ID>.folderSkipped=CRM_SKIPPED
# IMAP folder for moving sent messages in
#messageType.<ID>.folderSent=CRM_SENT
# IMAP folder for moving deleted messages in
#messageType.<ID>.folderTrash=Trash

# SMTP without SSL
#messageType.<ID>.mail.transport.protocol=smtp
# SMTP port instead of 465 for SMTP SSL and 25 for SMTP without SSL
#messageType.<ID>.mail.smtp.port=
# SMTP login instead of <EMAIL>
#messageType.<ID>.mail.smtp.user=
# SMTP password instead of <IMAP_PASSWORD>
messageType.<ID>.mail.smtp.pswd=

# debug IMAP and SMTP exchange
#messageType.<ID>.debug=1

# do not inform about new unprocessed messages of the type
#messageType.<ID>.unprocessedMessageNotify=0
# leave processed messages unread
#messageType.<ID>.processed.read=0

# do not check empty subject on saving
#messageType.<ID>.check.empty.subject=0
# different address From instead of <EMAIL>
#messageType.<ID>.from=
# different address Reply-To instead of <EMAIL>
#messageType.<ID>.replayTo=

# disable default signature
#messageType.<ID>.sign.standard=0
# JEXL expression for generation signature text
#messageType.<ID>.sign.expression=<SIGN_EXPRESSION>

<SIGN_EXPRESSION> - JEXL expression for building signature, context variables:

See configuration examples for different Email providers below.

Examples

Zoho Mail EU

Log to the account on https://mail.zoho.eu in, click Setting on the top right corner, and enable IMAP access there.

messageType.1.title==account@domain.com
messageType.1.class=MessageTypeEmail
messageType.1.email==account@domain.com
messageType.1.host=imappro.zoho.eu
messageType.1.pswd=*****
messageType.1.mail.smtp.host=smtppro.zoho.eu
Yandex
messageType.1.title=account@domain.com
messageType.1.class=MessageTypeEmail
messageType.1.email=account@domain.com
messageType.1.host=imap.yandex.com
messageType.1.pswd=*****
messageType.1.folderTrash=trash
messageType.1.mail.smtp.host=smtp.yandex.com
GMail
Obtaining regular IMAP/SMTP access for an GMail account might be especially tricky because of constantly changed Google security policy
messageType.1.title=account@gmail.com
messageType.1.class=MessageTypeEmail
messageType.1.email=account@gmail.com
messageType.1.host=imap.gmail.com
messageType.1.pswd=*****
messageType.1.folderProcessed=INBOX.CRM_PROCESSED
messageType.1.folderSkipped=INBOX.CRM_SKIPPED
messageType.1.folderSent=INBOX.CRM_SENT
messageType.1.folderTrash=[Gmail]/Bin
messageType.1.mail.smtp.host=smtp.gmail.com

Quick Answer

Полученные по Email уведомления о новых сообщениях процесса могут быть использованы для быстрого ответа на них. Для этого в тему уведомлений добавляется маркер QA:код сообщения. Быстрый ответ может быть произведён на любой тип сообщения и идентичен написанию ответа из интерфейса BGERP. Пользователь идентифицируется по EMail, сохранённому в параметре типа EMail, код которого указывается в опции quickAnswerEmailParamId типа сообщения.

На адрес, с которого было отправлено уведомление, должен быть настроен тип сообщения с конфигурацией.

messageType.<ID>.title=Наименование
messageType.<ID>.class=MessageTypeEmail
...
messageType.<ID>.quickAnswerEmailParamId=21

Автосоздание процесса по Email

Для создания новых процессов из всех полученных Email в конфигурации типа сообщения добавить:

messageType.<ID>.autoCreateProcess.typeId=<typeId>
messageType.<ID>.autoCreateProcess.notification=1
messageType.<ID>.autoCreateProcess.notification.text.message=Dear customer, your request has been registered

Где <typeId> - код типа процесса.

Debug

After configuration a new email message type, open Messages tool and try to retrieve new messages from the email box. If the messages do not appear there, see logs for the reason.

messages

For testing email sending add a process message and execute the <<scheduler task.

Process Type

Process Change Notifications

Plugin can send Email notifications about process related updates:

  • changes of process status or executors list;

  • new incoming process messages, notification email subject contains in this case Quick Answer identifier;

  • paid process invoices.

These mails are sent to process executor users, excluding ones, performed the update.

The feature can be enabled in process type configuration.

email:change.notification.user.email.param=<paramId>

Where <paramId> can be 0 for selecting first user parameter with type email or point to a definite user param ID.

Links for opening processes are built from configuration parameters.

Sending Mails from JEXL

Email can be sent using simple processor, here is the sample of configuration.

onProcessEvent.{@inc:cnt}.events=statusChanged
onProcessEvent.{@cnt}.doExpression=<<END
    text = process.getDescription();
    email.sendMessageToUsers({1}, 0, "Changed process status", text);
END

Object email of class org.bgerp.plugin.msg.email.ExpressionObject with API methods is provided by the plugin.

Usage

Message Queue

Newly incoming email messages have to be processed in Messages tool, where they are separated over processes or being deleted.

message new

Process for a processed message can be opened by the link.

message new processed

Process Messages

After the first process assignment, process-related message exchange happens in Messages tab.

process messages

That message can be replied.

process message reply

Or you can create a new process email.

process message editor

In any of these cases, an email sent from here will contain marker with process ID in its subject, that allows automatically assign all new customer’s replies to the same process.

Search Recipients

The feature has a separated permission Plugin Email / Search Recipients.

During message editing recipient addresses might be chooses over parameter values with type email.

process message search recipient

Areas where recipients are searched are defined in configuration. Possible values:

  • process - current process;

  • executors - current process executors;

  • process_customers - customers, linked to current process;

  • users - all the users in the system.

Attach History

In drop-down Attach history may be chosen the following options:

  • Exchange with the address;

  • All messages.

For both modes for each sent message has attached a file named History.txt, containing exchange with:

  • used Email address

  • all message history for second case

For the second mode in message signature also added process link to open interface, case it is configured.