.. _ticket-mail-pipe: ========================================= Configure incoming email pipe for tickets ========================================= End-users and staff users can open and reply to :ref:`support tickets` using the web interface or by sending email messages to the :ref:`support department's email address`. For incoming email messages - from end-users and from staff users - to be recorded in a support, ticket the following configuration is required. These steps have been tested on Ubuntu 22.04, with locally installed Postfix mail server. The commands may differ slightly on other Linux distributions or versions. .. note:: This page refers to INCOMING email messages, that is, email messages received by Fleio and recorded in the ticketing system. For OUTGOING email messages, in other words, emails sent by Fleio, see :ref:`email-settings`. Install postfix, choose "Internet site" when asked and fill in as "System mail name" the FQDN (Fully Qualified Domain Name), e.g. "mydomain.com". Note that you need the corresponding MX DNS record of this FQDN to point to the public IP address of the machine where Fleio is installed. .. code-block:: bash sudo apt install postfix systemctl enable postfix Make sure the :ref:`support department` is created and let's say with ``support@mydomain.com`` email address. Impersonate the ``fleio``` user end edit the following file: .. code-block:: bash sudo -i -u fleio cd /home/fleio nano .aliases add the following content to file ``/home/fleio/.aliases``: .. code-block:: bash support: | "docker exec -i fleio-incomingmail-1 /var/webapps/fleio/scripts/incoming_pipe" .. note:: On some systems, the email address you are configuring for a support department may already exist in ``/etc/aliases``. For example "support" is already configured in /etc/aliases on CentOS 8. If this is the case, remove it from ``/etc/aliases`` while still in the ``/home/fleio/`` directory, run: .. code-block:: bash postalias /home/fleio/.aliases # exit "fleio" user impersonation exit as ``root``, edit file ``/etc/postfix/main.cf``. On the ``alias_maps`` line, add the new alias file (just the part starting with the comma is newly added): .. code-block:: bash alias_maps = hash:/etc/aliases, hash:/home/fleio/.aliases and restart postfix: .. code-block:: bash systemctl restart postfix At this point email sent to ``support@mydomain.com`` should automatically open a support ticket. Email notifications are also **sent** when a support ticket is opened or when a reply is added. For outgoing email settings see :ref:`email-settings`. .. _log-ticket-emails: Debug incoming ticket emails ============================ For debugging purposes, you may want to log the content of the incoming email messages that are piped to the ticketing system. The mail server pipeline must be correctly configured as explained above in order to actually log an incoming email message. To enable incoming email message logging add this to :ref:`settings.py`: .. code-block:: python LOG_EMAILS_RELATED_TO_TICKETS = True Then you will find the logged email messages in the following path from the ``utils`` container: .. code-block:: bash # enter the utils container fleio bash ls /var/fleio/ticket_emails cat /var/fleio/ticket_emails/... # to exit the utils container: exit alternatively, you can list files directly from the host (without entering the ``utils`` container): .. code-block:: bash fleio bash ls /var/fleio/ticket_emails fleio bash cat /var/fleio/ticket_emails/2023-5-17/2023-5-17-7-28-476aa961-af22-4fcf-9fef-7049a1aa2047.eml