Optimized mail integration and solved bugs (hopefully I didn't create more)

This commit is contained in:
Kevin Veen-Birkenbach 2025-01-16 16:36:15 +01:00
parent d1bec25781
commit b0d5396ea8
13 changed files with 60 additions and 25 deletions

View File

@ -5,7 +5,7 @@ BASEROW_PUBLIC_URL=https://{{ domain }}
EMAIL_SMTP={{ system_email_smtp | upper }} EMAIL_SMTP={{ system_email_smtp | upper }}
EMAIL_SMTP_HOST={{ system_email_host }} EMAIL_SMTP_HOST={{ system_email_host }}
EMAIL_SMTP_PORT={{ system_email_smtp_port }} EMAIL_SMTP_PORT={{ system_email_smtp_port }}
EMAIL_SMTP_USER={{ system_email_address }} EMAIL_SMTP_USER={{system_email_username}}
EMAIL_SMTP_PASSWORD={{ system_email_password }} EMAIL_SMTP_PASSWORD={{ system_email_password }}
EMAIL_SMTP_USE_TLS={{ system_email_tls | upper }} EMAIL_SMTP_USE_TLS={{ system_email_tls | upper }}

View File

@ -187,7 +187,9 @@ LDAP_AUTH=
LDAP_PASSWORD= LDAP_PASSWORD=
LDAP_ROLE_FIELD= LDAP_ROLE_FIELD=
LDAP_FILTER= LDAP_FILTER=
# ====================================
# GREENLIGHT CONFIGURATION
# ====================================
# Set this to true if you want GreenLight to support user signup and login without # Set this to true if you want GreenLight to support user signup and login without
# Omniauth. For more information, see: # Omniauth. For more information, see:
# #
@ -195,16 +197,23 @@ LDAP_FILTER=
# #
ALLOW_GREENLIGHT_ACCOUNTS=true ALLOW_GREENLIGHT_ACCOUNTS=true
### SMTP CONFIGURATION
# Emails are required for the basic features of Greenlight to function.
# Please refer to your SMTP provider to get the values for the variables below
SMTP_SERVER={{system_email_host}} SMTP_SERVER={{system_email_host}}
SMTP_DOMAIN={{domain}} SMTP_DOMAIN={{domain}}
SMTP_PORT={{system_email_smtp_port}} SMTP_PORT={{system_email_smtp_port}}
SMTP_USERNAME={{system_email_address}} SMTP_USERNAME={{system_email_username}}
SMTP_PASSWORD={{system_email_password}} SMTP_PASSWORD={{system_email_password}}
SMTP_AUTH=plain SMTP_AUTH=plain
SMTP_OPENSSL_VERIFY_MODE=none SMTP_OPENSSL_VERIFY_MODE=none
SMTP_STARTTLS_AUTO={{system_email_start_tls}} SMTP_STARTTLS_AUTO={{system_email_start_tls | lower}}
SMTP_SENDER={{system_email_address}} SMTP_STARTTLS={{system_email_start_tls | lower}}
SMTP_SENDER_EMAIL={{system_email_address}} SMTP_TLS={{system_email_tls | lower}}
SMTP_SSL_VERIFY=true
SMTP_SENDER={{system_email_from}}
SMTP_SENDER_EMAIL={{system_email_from}}
# Prefix for the applications root URL. # Prefix for the applications root URL.
# Useful for deploying the application to a subdirectory, which is highly recommended # Useful for deploying the application to a subdirectory, which is highly recommended

View File

@ -57,11 +57,11 @@ env:
# WARNING the char '#' in SMTP password can cause problems! # WARNING the char '#' in SMTP password can cause problems!
DISCOURSE_SMTP_ADDRESS: {{ system_email_host }} DISCOURSE_SMTP_ADDRESS: {{ system_email_host }}
DISCOURSE_SMTP_PORT: {{ system_email_smtp_port }} DISCOURSE_SMTP_PORT: {{ system_email_smtp_port }}
DISCOURSE_SMTP_USER_NAME: {{system_email_address}} DISCOURSE_SMTP_USER_NAME: {{system_email_username}}
DISCOURSE_SMTP_PASSWORD: {{ system_email_password }} DISCOURSE_SMTP_PASSWORD: {{ system_email_password }}
DISCOURSE_SMTP_ENABLE_START_TLS: {{ system_email_start_tls | upper }} DISCOURSE_SMTP_ENABLE_START_TLS: {{ system_email_start_tls | upper }}
DISCOURSE_SMTP_DOMAIN: {{ system_email_domain }} DISCOURSE_SMTP_DOMAIN: {{ system_email_domain }}
DISCOURSE_NOTIFICATION_EMAIL: {{system_email_address}} DISCOURSE_NOTIFICATION_EMAIL: {{system_email_from}}
# Database Configuration # Database Configuration
DISCOURSE_DB_USERNAME: {{ database_username }} DISCOURSE_DB_USERNAME: {{ database_username }}

View File

@ -38,10 +38,17 @@ docker-compose up -d --force-recreate && sleep 2; docker compose exec --user www
### info ### info
```bash ```bash
## Check general config
cat /var/lib/docker/volumes/friendica_data/_data/config/local.config.php cat /var/lib/docker/volumes/friendica_data/_data/config/local.config.php
## Check environment variables ## Check environment variables
docker compose exec -it application printenv docker compose exec -it application printenv
## Check email configuration
docker compose exec -it application cat /etc/msmtprc
``` ```
## email debugging:
echo "Testnachricht" | msmtp --account=system_email -t kevin@veen.world
## create user ## create user
INSERT INTO user (guid, username, email, password, verified, register_date, account_expires_on, account_expired) INSERT INTO user (guid, username, email, password, verified, register_date, account_expires_on, account_expired)
VALUES ( VALUES (

View File

@ -37,8 +37,8 @@ services:
SMTP_PORT: {{system_email_smtp_port}} SMTP_PORT: {{system_email_smtp_port}}
SMTP_AUTH_USER: {{system_email_username}} SMTP_AUTH_USER: {{system_email_username}}
SMTP_AUTH_PASS: {{system_email_password}} SMTP_AUTH_PASS: {{system_email_password}}
SMTP_STARTTLS: "{{ 'On' if system_email_start_tls else 'Off' }}" SMTP_STARTTLS: {{ 'on' if system_email_start_tls else 'off' }}
SMTP_FROM: {{system_email_address}} SMTP_FROM: {{system_email_from}}
# Administrator Credentials # Administrator Credentials
FRIENDICA_ADMIN_MAIL: {{administrator_email}} FRIENDICA_ADMIN_MAIL: {{administrator_email}}

View File

@ -18,12 +18,12 @@ REDIS_PASSWORD=
SMTP_SERVER={{system_email_host}} SMTP_SERVER={{system_email_host}}
SMTP_PORT={{system_email_smtp_port}} SMTP_PORT={{system_email_smtp_port}}
SMTP_LOGIN={{system_email_address}} SMTP_LOGIN={{system_email_username}}
SMTP_PASSWORD={{system_email_password}} SMTP_PASSWORD={{system_email_password}}
SMTP_AUTH_METHOD=plain SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none SMTP_OPENSSL_VERIFY_MODE=none
SMTP_ENABLE_STARTTLS=auto SMTP_ENABLE_STARTTLS=auto
SMTP_FROM_ADDRESS=Mastodon <{{system_email_address}}> SMTP_FROM_ADDRESS=Mastodon <{{system_email_from}}>
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY= {{mastodon_active_record_encryption_deterministic_key}} ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY= {{mastodon_active_record_encryption_deterministic_key}}
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT={{mastodon_active_record_encryption_key_derivation_salt}} ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT={{mastodon_active_record_encryption_key_derivation_salt}}

View File

@ -33,12 +33,12 @@ admin_contact: 'mailto:{{administrator_email}}'
email: email:
smtp_host: "{{system_email_host}}" smtp_host: "{{system_email_host}}"
smtp_port: "{{system_email_smtp_port}}" smtp_port: "{{system_email_smtp_port}}"
smtp_user: "{{system_email_address}}" smtp_user: "{{system_email_from}}"
smtp_pass: "{{system_email_password}}" smtp_pass: "{{system_email_password}}"
#force_tls: true #force_tls: true
#require_transport_security: true #require_transport_security: true
enable_tls: "{{ system_email_tls | upper }}" enable_tls: "{{ system_email_tls | upper }}"
notif_from: "Your Friendly %(app)s homeserver <{{system_email_address}}>" notif_from: "Your Friendly %(app)s homeserver <{{system_email_from}}>"
app_name: "Matrix on {{synapse_domain}}" app_name: "Matrix on {{synapse_domain}}"
enable_notifs: true enable_notifs: true
notif_for_new_users: false notif_for_new_users: false

View File

@ -13,11 +13,27 @@ services:
volumes: volumes:
- data:/var/www/html - data:/var/www/html
environment: environment:
# Database Configuration
MYSQL_DATABASE: "{{database_name}}" MYSQL_DATABASE: "{{database_name}}"
MYSQL_USER: "{{database_username}}" MYSQL_USER: "{{database_username}}"
MYSQL_PASSWORD: "{{database_password}}" MYSQL_PASSWORD: "{{database_password}}"
MYSQL_HOST: {{database_host}}:3306 MYSQL_HOST: {{database_host}}:3306
# Memory
PHP_MEMORY_LIMIT: 1G # Required for plugin duplicate finder PHP_MEMORY_LIMIT: 1G # Required for plugin duplicate finder
# Email Configuration
SMTP_HOST: {{system_email_host}}
SMTP_SECURE: {{ 'ssl' if system_email_start_tls else 'tls' }}
SMTP_PORT: {{system_email_smtp_port}}
SMTP_NAME: {{system_email_username}}
SMTP_PASSWORD: {{system_email_password}}
# Email from configuration
# MAIL_FROM_ADDRESS: no-reply
# MAIL_DOMAIN: {{domain}}
At least SMTP_HOST, MAIL_FROM_ADDRESS and MAIL_DOMAIN must be set for the configurations to be applied.
{% include 'templates/docker/container/depends-on-database-redis.yml.j2' %} {% include 'templates/docker/container/depends-on-database-redis.yml.j2' %}
{% include 'templates/docker/container/networks.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %}

View File

@ -14,11 +14,11 @@ PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback"]
PEERTUBE_SECRET={{peertube_secret}} PEERTUBE_SECRET={{peertube_secret}}
# E-mail configuration # E-mail configuration
PEERTUBE_SMTP_USERNAME={{system_email_address}} PEERTUBE_SMTP_USERNAME={{system_email_username}}
PEERTUBE_SMTP_PASSWORD={{system_email_password}} PEERTUBE_SMTP_PASSWORD={{system_email_password}}
PEERTUBE_SMTP_HOSTNAME={{system_email_host}} PEERTUBE_SMTP_HOSTNAME={{system_email_host}}
PEERTUBE_SMTP_PORT={{system_email_smtp_port}} PEERTUBE_SMTP_PORT={{system_email_smtp_port}}
PEERTUBE_SMTP_FROM={{system_email_address}} PEERTUBE_SMTP_FROM={{system_email_from}}
PEERTUBE_SMTP_TLS={{ system_email_tls | lower }} PEERTUBE_SMTP_TLS={{ system_email_tls | lower }}
PEERTUBE_SMTP_DISABLE_STARTTLS={{ 'false' if system_email_start_tls else 'true' }} PEERTUBE_SMTP_DISABLE_STARTTLS={{ 'false' if system_email_start_tls else 'true' }}
PEERTUBE_ADMIN_EMAIL={{system_email_address}} PEERTUBE_ADMIN_EMAIL={{system_email_from}}

View File

@ -48,11 +48,13 @@ RESTRICTED_INSTANCE=false
MAIL_DRIVER=log MAIL_DRIVER=log
MAIL_HOST={{system_email_host}} MAIL_HOST={{system_email_host}}
MAIL_PORT={{system_email_smtp_port}} MAIL_PORT={{system_email_smtp_port}}
MAIL_FROM_ADDRESS="{{system_email_address}}" MAIL_FROM_ADDRESS="{{system_email_from}}"
MAIL_FROM_NAME="Pixelfed" MAIL_FROM_NAME="Pixelfed"
MAIL_USERNAME={{system_email_address}} MAIL_USERNAME={{system_email_username}}
MAIL_PASSWORD={{system_email_password}} MAIL_PASSWORD={{system_email_password}}
MAIL_ENCRYPTION=tls # Not sure if the following is correct
# Checkout: https://github.com/pixelfed/pixelfed/blob/dev/.env.docker
MAIL_ENCRYPTION={{ 'ssl' if system_email_start_tls else 'tls' }}
## Databases (MySQL) ## Databases (MySQL)
DB_CONNECTION=mysql DB_CONNECTION=mysql

View File

@ -15,9 +15,9 @@ POSTGRES_PASSWORD={{database_password}} # database user's password
EMAIL_BACKEND = console # use an SMTP server or display the emails in the console (either "smtp" or "console") EMAIL_BACKEND = console # use an SMTP server or display the emails in the console (either "smtp" or "console")
EMAIL_HOST = {{system_email_host}} # SMTP server address EMAIL_HOST = {{system_email_host}} # SMTP server address
EMAIL_PORT = {{system_email_smtp_port}} # default SMTP port EMAIL_PORT = {{system_email_smtp_port}} # default SMTP port
EMAIL_HOST_USER = {{system_email_address}} # user to connect the SMTP server EMAIL_HOST_USER = {{system_email_username}} # user to connect the SMTP server
EMAIL_HOST_PASSWORD = {{system_email_password}} # SMTP user's password EMAIL_HOST_PASSWORD = {{system_email_password}} # SMTP user's password
EMAIL_DEFAULT_FROM = {{system_email_address}} # default email address for the automated emails EMAIL_DEFAULT_FROM = {{system_email_from}} # default email address for the automated emails
# EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive (only set one of those to True) # EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive (only set one of those to True)
EMAIL_USE_TLS={{ system_email_tls | lower | capitalize }} # use TLS (secure) connection with the SMTP server EMAIL_USE_TLS={{ system_email_tls | lower | capitalize }} # use TLS (secure) connection with the SMTP server
EMAIL_USE_SSL={{ 'False' if system_email_start_tls else 'True' }} # use implicit TLS (secure) connection with the SMTP server EMAIL_USE_SSL={{ 'False' if system_email_start_tls else 'True' }} # use implicit TLS (secure) connection with the SMTP server

View File

@ -2,6 +2,7 @@
defaults defaults
auth on auth on
logfile ~/.msmtp.log logfile ~/.msmtp.log
tls_starttls {{ 'on' if system_email_start_tls else 'off' }}
{% if system_email_tls %} {% if system_email_tls %}
tls on tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt tls_trust_file /etc/ssl/certs/ca-certificates.crt
@ -12,8 +13,8 @@ tls off
account system_email account system_email
host {{system_email_host}} host {{system_email_host}}
port {{system_email_smtp_port}} port {{system_email_smtp_port}}
from {{system_email_address}} from {{system_email_from}}
user {{system_email_address}} user {{system_email_username}}
password {{system_email_password}} password {{system_email_password}}
account default : system_email account default : system_email

View File

@ -2,7 +2,7 @@
/usr/bin/sendmail -t <<ERRMAIL /usr/bin/sendmail -t <<ERRMAIL
To: {{administrator_email}} To: {{administrator_email}}
From: systemd <{{system_email_address}}> From: systemd <{{system_email_from}}>
Subject: $1 Subject: $1
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8