Table of Contents

Install

apt install sympa 6.2.70 on ubuntu 24.04

mysql

sudo mysql -p -e "CREATE DATABASE IF NOT EXISTS sympa CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER IF NOT EXISTS 'sympa'@'localhost' IDENTIFIED BY '<RANDOM PASSWORD HERE>'; GRANT ALL PRIVILEGES ON sympa.* TO 'sympa'@'localhost'; FLUSH PRIVILEGES;"

sudo bash -c 'cat >> /etc/sympa/sympa/sympa.conf <<EOF
###\\\\ Database parameters ////###
db_type mysql
db_host localhost
db_user sympa
db_passwd <RANDOM PASSWORD HERE>
db_name sympa
EOF'

nginx

apparently standard setup is with Apache? But this works

server {
    listen 80;
    server_name <SUBDOMAIN NAME HERE>;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl; 
    server_name <SUBDOMAIN NAME HERE>;

    ssl_certificate /etc/letsencrypt/live/<SOMETHINGSOMETHING>/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/<SOMETHINGSOMETHING>//privkey.pem;

    root /usr/lib/cgi-bin/sympa;
    
    access_log /var/log/nginx/sympa-access.log;
    error_log /var/log/nginx/sympa-error.log;

    location /static-sympa/ {
        alias /usr/share/sympa/static_content/;
        access_log off;
    }

    location /css-sympa/ {
        alias /var/lib/sympa/css/;
        access_log off;
    }

    location /pictures-sympa/ {
        alias /var/lib/sympa/pictures/;
        access_log off;
    }

    location / {
        include fastcgi_params;
        fastcgi_pass unix:/run/sympa/wwsympa.socket;
        fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/sympa/wwsympa.fcgi;
        fastcgi_param SCRIPT_NAME "";
        fastcgi_param PATH_INFO $uri;
    }
}

Postfix

main.cf
sympa     unix  -       n       n      -        -       pipe
  flags=R user=sympa argv=/usr/lib/sympa/bin/queue ${recipient}
master.cf
sympa     unix  -       n       n      -        -       pipe
  flags=R user=sympa argv=/usr/lib/sympa/bin/queue ${recipient}

/etc/sympa/sympa/sympa.conf

wwsympa_url <YOUR_SUBDOMAIN>

# 1. Add email address text when list is created
alias_manager /usr/lib/sympa/bin/alias_manager.pl

# 2. compile email address text and add to db
aliases_program /usr/sbin/postalias

# 3. file Location for text and db
sendmail_aliases /etc/sympa/aliases.sympa.postfix

# If you have trouble change from default log_level 1
log_level 2

# The sympa manager defaults to sympa so emails to subscribe/unsubscribe etc. will come from sympa@DOMAIN. You can change this. For example, to have them come from manager instead add the below line:
email manager

Notes

Troubleshooting

Configuration

Amazon SES relay

Customizing Templates

Sympa uses a “Cascading” template system. It looks for a template (like welcome.tt2) in this specific order:

  1. List Level: /var/lib/sympa/list_data/[list_name]/mail_tt2/ (Highest Priority)
  2. Robot/Domain Level: /etc/sympa/[domain]/mail_tt2/
  3. Site Level: /etc/sympa/mail_tt2/
  4. Default: /usr/share/sympa/default/mail_tt2/ (Lowest Priority)

Cascaded Templates for messages sent to the list

  1. List Level: /etc/sympa/list_configs/[list_name]/message.footer.mime
  2. Robot/Domain Level: /etc/sympa/lists.lawrencemakers.org/message.footer.mime
  3. Site/Global Level: /etc/sympa/message.footer.mime
  4. Default: /usr/share/sympa/default/message.footer.mime

Unsubscribe Header

The Standard Header (RFC 2369)

List-Unsubscribe: <mailto:sympa@<DOMAIN>?subject=SIGNOFF%20<LIST_NAME>>, <https://<DOMAIN>/signoff/<LIST_NAME>/user@email.com>

List Config

# make a home for the new default override
sudo mkdir -p /etc/sympa/create_list_templates
# copy from the original default
sudo cp -r /usr/share/sympa/default/create_list_templates/discussion_list /etc/sympa/create_list_templates/
# edit to your heart's content:
sudo emacs -nw /etc/sympa/create_list_templates/discussion_list/config.tt2

Prettying it up

Logo and Favicon

logo_html_definition <a href="https://<DOMAIN>"><img src="/static-sympa/<FILENAME>" alt="my great logo" style="max-height: 120px; width: auto; border: 0;"></a>
# adjust max-height as appropriate
favicon_url /static-sympa/<BASEFILENAME>.ico

Null Sender

Defining the problem

Workaround

yes I know this is a terrible workaround but couldn't figure out anything better

#change
($return_path eq '<>' ? '' : $return_path), '--', @rcpt;
#to
($return_path eq '<>' ? 'no-reply@SYMPA_SUBDOMAIN' : $return_path), '--', @rcpt;
#!/bin/bash

FILE="/usr/share/sympa/lib/Sympa/Mailer.pm"
TARGET_MD5="<PUT MD5 HERE>"


# Check if the file exists
if [ ! -f "$FILE" ]; then
    /usr/bin/echo "Error: File '$FILE' not found."
    /usr/bin/logger -t checkMailer "Error: File '$FILE' not found."
    /usr/bin/swaks --from FROM_ADDR --to TO_ADDR --h-Subject "checkMailer: FILE NOT FOUND" --body "Error: File '$FILE' not found." --server localhost

    exit 1
fi

# Get the md5 of the file
MD5=$(md5sum /usr/share/sympa/lib/Sympa/Mailer.pm | awk {'print $1'})

# Compare the md5 to the target
if [ "$MD5" == "$TARGET_MD5" ]; then
    /usr/bin/echo "INFO: md5 for $FILE matches target."
    /usr/bin/logger -t checkMailer "INFO: md5 for $FILE matches target."
    /usr/bin/swaks --from FROM_ADDR --to TO_ADDR --h-Subject "checkMailer: md5 matches" --body "Good news: the md5 of $FILE has not changed" --server localhost
else
    /usr/bin/echo "WARNING: md5 for $FILE does NOT match target."
    /usr/bin/logger -t checkMailer "WARNING: md5 for $FILE does NOT match target."
    /usr/bin/swaks --from FROM_ADDR --to TO_ADDR --h-Subject "checkMailer: md5 does NOT match" --body "Bad news: the md5 of $FILE changed. Update null sender now." --server localhost
fi

Oh wait but we aren't done: Admin email is passing Google DKIM but failing Outlook DKIM

Outlook is pretty unhappy with Content-Type: multipart/report. To fix this:

Misc