I’m running Gitea in a Docker container (setup details below). I’mm attempting to enable email notifications using Sendmail, but I fail. Gitea gives an error message when I try to send a test mail (details below). Using sendmail
in the container also fails:
{host}$ docker-compose exec server /bin/bash
WARNING: The GITEA_USER_UID variable is not set. Defaulting to a blank string.
WARNING: The GITEA_USER_GID variable is not set. Defaulting to a blank string.
bash-4.3# echo "Subject: Test" | sendmail -v alice@example.org
sendmail: can't connect to remote host (127.0.0.1): Connection refused
bash-4.3#
I’ve verified that sendmail works on the host and that the message is delievered, e.g.
{host}$ echo "Subject: Test" | sendmail -v alice@example.org
Mail Delivery Status Report will be mailed to <alice>.
Questions
I’m a rookie with both Gitea and Docker.
-
Can I expect Sendmail to work with the Gitea 1.3.2 Docker container?
-
Is there anything I need to configure in my
docker-compose.yml
file (details below)? -
Do I need to tweak the Dockerfile, e.g. install additional software?
My Gitea Setup
I’m running Gitea in a Docker container configured as:
$ cat docker-compose.yml
version: "2"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:1.3.2
restart: always
networks:
- gitea
volumes:
- ./gitea:/data:Z
ports:
- "8080:3000"
- "2022:22"
environment:
- USER_UID=${GITEA_USER_UID}
- USER_GID=${GITEA_USER_GID}
In gitea/conf/app.ini
, I have:
[mailer]
ENABLED = true
USE_SENDMAIL = true
FROM = test@example.org
SENDMAIL_PATH = /usr/sbin/sendmail
After restarting, The ‘Mailer Configuration’ panel under ‘Configuration’ shows:
Enabled : [x]
Name : Gitea Hub
Use : Sendmail
Sendmail Path : /usr/sbin/sendmail
Extra arguments to Sendmail: []
User: : (empty)
When I enter am email address and hit ‘Send Test Mail’, the ‘Configuration’ page responds with error: “Failed to send test email to ‘alice@example.org’: gomail: could not send email 1: exit status 1”.