cancel
Showing results for 
Search instead for 
Did you mean: 

Configure mail service on Alfresco Community 7.2 installed using Docker Compose

Phfirst
Champ on-the-rise
Champ on-the-rise

Hello community
I installed alfresco Community 7.2 using Docker Compose on Ubuntu 20.04
I want to implement mail service for notifications. I followed the official documentation but found that I may not have the alfresco-global.properties file where to add the properties.
However, I have four alfresco-global.properties files located at:
/var/lib/docker/overlay2/615da5d5f405f76a9b1eca9143061ab4f42bb7c0221488544ea1ff5bdf61f6dd/diff/usr/local/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/module/alfresco-share-services/alfresco-global.properties

/var/lib/docker/overlay2/b2b206abb8d61b31245e997d9c528d84ae00ef0df98a6bba10b431c440d6392a/diff/usr/local/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/module/alfresco-share-services/alfresco-global.properties

/var/lib/docker/overlay2/502e766e1649c6a6c8bb73354bb77a8f6c126acd6d99fad635048a6a2a20b64c/diff/usr/local/tomcat/shared/classes/alfresco-global.properties

/var/lib/docker/overlay2/adce94ea8056b9973759739f4f56379fa832d1739e0c627f50bbc5d32643b25b/diff/usr/local/tomcat/shared/classes/alfresco-global.properties

The first two contain only:
# Disable load of sample site
#
sample.site.disabled=false

And the last two are empty. So I don't know in which files to put the properties

I followed this instruction from the hub ( https://hub.alfresco.com/t5/alfresco-content-services-forum/alfresco-community-6-2-docker-outbound-e... ) where it's the docker-compose.yml file which contains the properties but my email is not sent. In the logs, I get the following errors after adding a user to a site or after assigning a workflow to a user:

2022-06-09 10:48:50,801 ERROR [action.executer.MailActionExecuter] [http-nio-8080-exec-7] Failed to send email to ***********@gmail.com : org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com; message exceptions (1) are:Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com

Here are the added properties:

-notification.email.siteinvite=true
-Dmail.host=smtp.gmail.com
-Dmail.port=465
-Dmail.username=***************@gmail.com
-Dmail.password=***************
-Dmail.protocol=smtps
-Dmail.smtps.starttls.enable=true
-Dmail.smtps.auth=true
-mail.smtps.starttls.enable=true
-mail.smtps.auth=true

Here are my constraints, what can I do?
Please help me to get out of this. Tanks.

12 REPLIES 12

angelborroy
Community Manager Community Manager
Community Manager

You can use Docker environment variables for every Alfreco property you need to add.

Just modify your docker-compose.yml file to include mail settings:

services:
    alfresco:
        environment:
            JAVA_OPTS : '
-Dnotification.email.siteinvite=true
-Dmail.host=smtp.gmail.com
-Dmail.port=465
-Dmail.username=***************@gmail.com
-Dmail.password=***************
-Dmail.protocol=smtps
-Dmail.smtps.starttls.enable=true
-Dmail.smtps.auth=true
-Dmail.smtps.starttls.enable=true
-Dmail.smtps.auth=true '
Hyland Developer Evangelist


@angelborroy wrote:

You can use Docker environment variables for every Alfreco property you need to add.

Just modify your docker-compose.yml file to include mail settings:

services:
    alfresco:
        environment:
            JAVA_OPTS : '
-Dnotification.email.siteinvite=true
-Dmail.host=smtp.gmail.com
-Dmail.port=465
-Dmail.username=***************@gmail.com
-Dmail.password=***************
-Dmail.protocol=smtps
-Dmail.smtps.starttls.enable=true
-Dmail.smtps.auth=true
-Dmail.smtps.starttls.enable=true
-Dmail.smtps.auth=true '

Thank you for your reply.
But it still does not work (the email is not sent).
Here is the error I get in the when I add a user to a site:

ERROR [action.executer.MailActionExecuter] [http-nio-8080-exec-10] Failed to send email to ***********@gmail.com : org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com; message exceptions (1) are:Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com

We can see in the error the host smtp.example.com port 25 while I used as host smtp.gmail.com and 465 as port number. I don't know where this comes from.

Phfirst
Champ on-the-rise
Champ on-the-rise

Please, has anyone been able to find a solution for my problem above ?

abhinavmishra14
World-Class Innovator
World-Class Innovator

As mentioned by @angelborroy you need to pass the params correctly.

Please share your full docker-compose file. 

Here is a full sample, if that helps: 

version: "2"

services:
  alfresco:
    image: alfresco/alfresco-content-repository-community:7.2.0
    mem_limit: 2g
    environment:
      JAVA_TOOL_OPTIONS: "
        -Dencryption.keystore.type=JCEKS
        -Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
        -Dencryption.keyAlgorithm=DESede
        -Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
        -Dmetadata-keystore.password=mp6yc0UD9e
        -Dmetadata-keystore.aliases=metadata
        -Dmetadata-keystore.metadata.password=oKIWzVdEdA
        -Dmetadata-keystore.metadata.algorithm=DESede
        "
      JAVA_OPTS: "
        -Ddb.driver=org.postgresql.Driver
        -Ddb.username=alfresco
        -Ddb.password=alfresco
        -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
        -Dsolr.host=solr6
        -Dsolr.port=8983
        -Dsolr.http.connection.timeout=1000
        -Dsolr.secureComms=secret
        -Dsolr.sharedSecret=secret
        -Dsolr.base.url=/solr
        -Dindex.subsystem.name=solr6
        -Dshare.host=127.0.0.1
        -Dshare.port=8080
        -Dalfresco.host=localhost
        -Dalfresco.port=8080
        -Daudit.enabled=true
        -Daudit.alfresco-access.enabled=true
        -Daudit.filter.alfresco-access.default.enabled=true
        -Daudit.alfresco-access.sub-actions.enabled=true
        -Daudit.filter.alfresco-access.transaction.user=\"~System;~null;.*\"
        -Daudit.filter.alfresco-access.transaction.action=\"~.*;null\"
        -Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
        -Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
        -Ddeployment.method=DOCKER_COMPOSE
        -DlocalTransform.core-aio.url=http://transform-core-aio:8090/
        -Dcsrf.filter.enabled=false
        -Dnotification.email.siteinvite=true
        -Dmail.host=smtp.gmail.com
        -Dmail.port=465
        -Dmail.username=***************@gmail.com
        -Dmail.password=***************
        -Dmail.protocol=smtps
        -Dmail.smtps.starttls.enable=true
        -Dmail.smtps.auth=true
        -Dmail.smtps.starttls.enable=true
        -Dmail.smtps.auth=true
        -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
        "

  transform-core-aio:
    image: alfresco/alfresco-transform-core-aio:2.5.7
    mem_limit: 1536m
    environment:
      JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
    ports:
      - "8090:8090"

  share:
    image: alfresco/alfresco-share:7.2.0
    mem_limit: 1g
    environment:
      REPO_HOST: "alfresco"
      REPO_PORT: "8080"
      JAVA_OPTS: "
        -XX:MinRAMPercentage=50
        -XX:MaxRAMPercentage=80
        -Dalfresco.host=localhost
        -Dalfresco.port=8080
        -Dalfresco.context=alfresco
        -Dalfresco.protocol=http
        "

  postgres:
    image: postgres:13.3
    mem_limit: 512m
    environment:
      - POSTGRES_PASSWORD=alfresco
      - POSTGRES_USER=alfresco
      - POSTGRES_DB=alfresco
    command: postgres -c max_connections=300 -c log_min_messages=LOG
    ports:
      - "5432:5432"

  solr6:
    image: alfresco/alfresco-search-services:2.0.3
    mem_limit: 2g
    environment:
      # Solr needs to know how to register itself with Alfresco
      SOLR_ALFRESCO_HOST: "alfresco"
      SOLR_ALFRESCO_PORT: "8080"
      # Alfresco needs to know how to call solr
      SOLR_SOLR_HOST: "solr6"
      SOLR_SOLR_PORT: "8983"
      # Create the default alfresco and archive cores
      SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
      # HTTPS or SECRET
      ALFRESCO_SECURE_COMMS: "secret"
      # SHARED SECRET VALUE
      JAVA_TOOL_OPTIONS: "
          -Dalfresco.secureComms.secret=secret
      "
    ports:
      - "8083:8983" # Browser port

  activemq:
    image: alfresco/alfresco-activemq:5.16.4-jre11-centos7
    mem_limit: 1g
    ports:
      - "8161:8161" # Web Console
      - "5672:5672" # AMQP
      - "61616:61616" # OpenWire
      - "61613:61613" # STOMP

  proxy:
    image: alfresco/alfresco-acs-nginx:3.2.0
    mem_limit: 128m
    environment:
      DISABLE_PROMETHEUS: "true"
      DISABLE_SYNCSERVICE: "true"
      DISABLE_ADW: "true"
    depends_on:
      - alfresco
    ports:
      - "8080:8080"
    links:
      - alfresco
      - share
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Hello,
Thanks for your help.
I think I put the parameters correctly as you say but sending the E-mail does not always work. And the following error remains:

Spoiler
ERROR [action.executer.MailActionExecuter] [http-nio-8080-exec-5] Failed to send email to akakpokophonso@gmail.com : org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com; message exceptions (1) are:Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com

Is there any other configuration to do that I don't know?


Also the official (...) documentation talks about MANAGING OUTGOING EMAILS where it states to put parameters by opening the Admin console, Mail Services then Outgoing Email; apart from CONFIGURE OUTGOING EMAILS. Is this an additional configuration that needs to be done too or not?


And here is my docker-compose.yml:

Spoiler

version: "2"

services:
alfresco:
image: quay.io/alfresco/alfresco-content-repository:7.2.0
mem_limit: 1900m
environment:
JAVA_TOOL_OPTIONS: "
-Dencryption.keystore.type=JCEKS
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
-Dencryption.keyAlgorithm=DESede
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
-Dmetadata-keystore.metadata.algorithm=DESede
"
JAVA_OPTS: "
-Ddb.driver=org.postgresql.Driver
-Ddb.username=alfresco
-Ddb.password=alfresco
-Ddb.url=jdbcSmiley Tongueostgresql://postgres:5432/alfresco
-Dsolr.host=solr6
-Dsolr.port=8983
-Dsolr.secureComms=secret
-Dsolr.sharedSecret=secret
-Dsolr.base.url=/solr
-Dindex.subsystem.name=solr6
-Dshare.host=127.0.0.1
-Dshare.port=8080
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
-Dmessaging.broker.url=\"failoverSmiley Sadnio://activemq:61616)?timeout=3000&jms.useCompression=true\"
-Ddeployment.method=DOCKER_COMPOSE
-Dtransform.service.enabled=true
-Dtransform.service.url=http://transform-router:8095
-Dsfs.url=http://shared-file-store:8099/
-DlocalTransform.core-aio.url=http://transform-core-aio:8090/
-Dcsrf.filter.enabled=false
-Ddsync.service.uris=http://localhost:9090/alfresco

-Dnotification.email.siteinvite=true
-Dmail.host=smtp.gmail.com
-Dmail.port=465
-Dmail.username=********@gmail.com
-Dmail.password=**********
-Dmail.protocol=smtps
-Dmail.smtps.starttls.enable=true
-Dmail.smtps.auth=true
-Dmail.smtps.starttls.enable=true
-Dmail.encoding=UTF-8
-Dmail.testmessage.send=true
-Dmail.testmessage.to=akakpokophonso@gmail.com
-Dmail.testmessage.subject=Email Test
-Dmail.testmessage.text= The outbound email service is working correctly
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
"

transform-router:
mem_limit: 512m
image: quay.io/alfresco/alfresco-transform-router:1.5.2
environment:
JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
ACTIVEMQ_URL: "nio://activemq:61616"
CORE_AIO_URL: "http://transform-core-aio:8090"
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
ports:
- "8095:8095"
links:
- activemq

transform-core-aio:
image: alfresco/alfresco-transform-core-aio:2.5.7
mem_limit: 1536m
environment:
JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
ACTIVEMQ_URL: "nio://activemq:61616"
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
ports:
- "8090:8090"
links:
- activemq

shared-file-store:
image: quay.io/alfresco/alfresco-shared-file-store:0.16.1
mem_limit: 512m
environment:
JAVA_OPTS: " -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
scheduler.content.age.millis: 86400000
scheduler.cleanup.interval: 86400000
ports:
- "8099:8099"
volumes:
- shared-file-store-volume:/tmp/Alfresco/sfs

share:
image: quay.io/alfresco/alfresco-share:7.2.0
mem_limit: 1g
environment:
REPO_HOST: "alfresco"
REPO_PORT: "8080"
JAVA_OPTS: "
-XX:MinRAMPercentage=50
-XX:MaxRAMPercentage=80
-Dalfresco.host=localhost
-Dalfresco.port=8080
-Dalfresco.context=alfresco
-Dalfresco.protocol=http
"

postgres:
image: postgres:13.3
mem_limit: 512m
environment:
- POSTGRES_PASSWORD=alfresco
- POSTGRES_USER=alfresco
- POSTGRES_DB=alfresco
command: postgres -c max_connections=300 -c log_min_messages=LOG
ports:
- "5432:5432"

solr6:
image: alfresco/alfresco-search-services:2.0.3
mem_limit: 2g
environment:
# Solr needs to know how to register itself with Alfresco
SOLR_ALFRESCO_HOST: "alfresco"
SOLR_ALFRESCO_PORT: "8080"
# Alfresco needs to know how to call solr
SOLR_SOLR_HOST: "solr6"
SOLR_SOLR_PORT: "8983"
# Create the default alfresco and archive cores
SOLR_CREATE_ALFRESCO_DEFAULTS: "alfresco,archive"
# HTTPS or SECRET
ALFRESCO_SECURE_COMMS: "secret"
# SHARED SECRET VALUE
JAVA_TOOL_OPTIONS: "
-Dalfresco.secureComms.secret=secret
"
ports:
- "8083:8983" # Browser port

activemq:
image: alfresco/alfresco-activemq:5.16.4-jre11-centos7
mem_limit: 1g
ports:
- "8161:8161" # Web Console
- "5672:5672" # AMQP
- "61616:61616" # OpenWire
- "61613:61613" # STOMP

digital-workspace:
image: quay.io/alfresco/alfresco-digital-workspace:2.7.0
mem_limit: 128m
environment:
APP_CONFIG_AUTH_TYPE: "BASIC"
BASE_PATH: ./
APP_BASE_SHARE_URL: "http://localhost:8080/workspace/#/preview/s"

control-center:
image: quay.io/alfresco/alfresco-admin-app:7.2.0
mem_limit: 128m
environment:
APP_CONFIG_PROVIDER: "ECM"
APP_CONFIG_AUTH_TYPE: "BASIC"
BASE_PATH: ./

proxy:
image: alfresco/alfresco-acs-nginx:3.3.0
mem_limit: 128m
depends_on:
- alfresco
- digital-workspace
- control-center
ports:
- "8080:8080"
links:
- digital-workspace
- alfresco
- share
- control-center

sync-service:
image: quay.io/alfresco/service-sync:3.7.0
mem_limit: 1g
environment:
JAVA_OPTS: "
-Dsql.db.driver=org.postgresql.Driver
-Dsql.db.url=jdbcSmiley Tongueostgresql://postgres:5432/alfresco
-Dsql.db.username=alfresco
-Dsql.db.password=alfresco
-Dmessaging.broker.host=activemq
-Drepo.hostname=alfresco
-Drepo.port=8080
-Ddw.server.applicationConnectors[0].type=http
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
"
ports:
- "9090:9090"

volumes:
shared-file-store-volume:
driver_opts:
type: tmpfs
device: tmpfs

abhinavmishra14
World-Class Innovator
World-Class Innovator

You docker-compose file look ok. Based on the error it seems lime there is somewhere the config is being overriden.

"Couldn't connect to host, port: smtp.example.com, 25; timeout -1; nested exception is: java.net.UnknownHostException: smtp.example.com"

You are using smtp.gmail.com and 465 but error refers to a different host. 

No additonal config is needed if you have the properties set. but if you have somehow updated the config via admin tools, then that may be taking precedence.

See if you somehow update the configs via admin console, try to match the Hostname and Email Server Port with the same properties you are using in docker-compose.yml file and see if that helps.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

I don't know if you are talking about the emails config in the admin console or any other config. I still did not make a config related to emails in the administration console.

However, I made customizations in other places including:

- change of logo in the share interface

- the creation of a personal theme in: /var/lib/docker/overlay2/63ad428db391e61747765f2fd423a0b6535fec89fd53ef58bcc3e0906aa811b3/diff/usr/local/tomcat/webapps/share/themes/ where the other theme folders are also located

- the modification of the css in login.css in: /var/lib/docker/overlay2/63ad428db391e61747765f2fd423a0b6535fec89fd53ef58bcc3e0906aa811b3/diff/usr/local/tomcat/webapps/share/components/guest/

- the creation of a customTheme.xml file in: /var/lib/docker/overlay2/63ad428db391e61747765f2fd423a0b6535fec89fd53ef58bcc3e0906aa811b3/diff/usr/local/tomcat/webapps/share/WEB-INF/classes/alfresco/site-data/themes/

- modification of messages in slingshot.properties in : /var/lib/docker/overlay2/63ad428db391e61747765f2fd423a0b6535fec89fd53ef58bcc3e0906aa811b3/diff/usr/local/tomcat/webapps/share/WEB-INF/classes/alfresco/messages/

- and the modification of the css of the footer.css in: /var/lib/docker/overlay2/63ad428db391e61747765f2fd423a0b6535fec89fd53ef58bcc3e0906aa811b3/diff/usr/local/tomcat/webapps/share/components/footer/

Is it these changes that are causing the settings in docker-compose.yml to not be taken into account?

abhinavmishra14
World-Class Innovator
World-Class Innovator

What i meant that, try updating from admin console once and see if that picks up. Sometimes we play around thing and unknowingly change values. 

All your share theme changes has no relation to smtp or anything with repo.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

It is well noted.
But unfortunately I don't know how to access the administration console in question and how to do ts update.
Or, do you want to talk about this one bellow (Alfresco Administration Console (admin only)) ?

image