Monica PRM Does Not Send Email Reminders - How to Fix This Issue

Monica PRM Does Not Send Email Reminders - How to Fix This Issue
In a recent update to my guide on installing Monica using Docker on Unraid, some users reported encountering an issue where email reminders were not being sent, and I faced the same problem. This issue, tracked on Monica’s GitHub under #4178, has a simple solution that I will share with you today.
The core solution involves running the cron job inside a dedicated Docker container. Below, I have shared the Docker-compose and .env configuration files that I use on my Unraid server. This setup resolves the issue, ensuring that Monica sends email reminders as expected.
Docker-compose File
🆕 To make it easier to copy/paste/download this code, I have created a dedicated repository for my blog resources on GitHub. Here is the link to the docker-compose.yml and .env files from this article:
https://github.com/AlexIn-Tech/alexin.tech_blog_ressources/tree/main/Docker/Monica
Here is the docker-compose.yml file:
version: "3.9"
services:
app:
image: monica
env_file: .env
depends_on:
- db
ports:
- 8181:80
volumes:
- /mnt/user/appdata/monica-webapp:/var/www/html/storage
restart: always
cron:
image: monica
env_file: .env
restart: always
volumes:
- /mnt/user/appdata/monica-webapp:/var/www/html/storage
command: cron.sh
depends_on:
- db
db:
image: mariadb:11
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=true
- MYSQL_DATABASE=monica
- MYSQL_USER=XXXXXXXXXXXXXXXXX
- MYSQL_PASSWORD=XXXXXXXXXXXXXXXXXXX
volumes:
- /mnt/user/appdata/monica-db:/var/lib/mysql
restart: always
adminer:
image: adminer
restart: always
ports:
- 8282:8080
Environment File (.env)
And here is the .env configuration file:
APP_ENV=local
APP_DEBUG=false
# The encryption key. Must be 32 characters long exactly.
# Use `echo -n 'base64:'; openssl rand -base64 32` to generate a random key.
APP_KEY=XXXXXXXXXXXXXXX
# The URL of your application.
# APP_URL=http://localhost
# Set trusted proxy IP addresses.
# To trust all proxies that connect directly to your server, use a "*".
# APP_TRUSTED_PROXIES=
# Database information
# DB_CONNECTION=mysql
DB_HOST=db
DB_DATABASE=monica
DB_USERNAME=XXXXXXXXXXXX
DB_PASSWORD=XXXXXXXXXXXXXXXXXXXXX
# Mail credentials used to send emails from the application.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.yourmailservice.com
MAIL_PORT=587
MAIL_USERNAME=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MAIL_PASSWORD=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MAIL_ENCRYPTION=tls
# Outgoing emails will be sent with these identity
MAIL_FROM_ADDRESS=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MAIL_FROM_NAME=Monica
LOG_CHANNEL=stderr
CACHE_DRIVER=database
SESSION_DRIVER=database
QUEUE_DRIVER=sync
Important Note: Ensure that you replace the placeholder values XXXXXXXXXXXXXXX with your actual credentials for the database, application key, mail service configuration, etc. Without this, the application will not function correctly, and the email reminders will not work.
By configuring the cron service in a separate container, we ensure that the necessary cron jobs for sending email reminders are executed reliably.
If you followed my previous guide on setting up Monica on Unraid and encountered this issue, implementing the above solution should allow your email reminders to function correctly. For further discussion or if you run into other issues, feel free to check out Monica’s GitHub issue page or contact me via the “Contact Me” form.
Enjoy 😎
AlexIn Tech
