#Dockerfile
ARG SMTP_MAILHUB
ARG SMTP_USER
ARG SMTP_PASS
ARG SMTP_PORT
ARG SMTP_FROM
RUN apt-get update && apt-get install -y msmtp
RUN echo "defaults" > /etc/msmtprc \
&& echo "account default" >> /etc/msmtprc \
&& echo "logfile /var/www/msmtp.log" >> /etc/msmtprc \
&& echo "host $SMTP_MAILHUB" >> /etc/msmtprc \
&& echo "port $SMTP_PORT" >> /etc/msmtprc \
&& echo "from $SMTP_FROM" >> /etc/msmtprc \
&& echo "auth on" >> /etc/msmtprc \
&& echo "tls on" >> /etc/msmtprc \
&& echo "tls_starttls off" >> /etc/msmtprc \
&& echo "tls_certcheck off" >> /etc/msmtprc \
&& echo "user $SMTP_USER" >> /etc/msmtprc \
&& echo "password $SMTP_PASS" >> /etc/msmtprc
#docker-compose.yml
services:
php-fpm:
build:
args:
- HOSTNAME=${HOSTNAME}
- SMTP_MAILHUB=${SMTP_MAILHUB}
- SMTP_USER=${SMTP_USER}
- SMTP_PASS=${SMTP_PASS}
- SMTP_PORT=${SMTP_PORT}
- SMTP_FROM=${SMTP_FROM}
SMTP_MAILHUB=local
SMTP_USER=user
SMTP_PASS=pass
SMTP_REWRITE_DOMAIN=