Sending emails from Alpine Docker container using SMTP from NameCheap.com

Note Statistics

Note Statistics

  • Viewed 128 times

Create Docker file

FROM php:7.4-fpm-alpine

RUN apk update
RUN apk add ssmtp

CMD ["php-fpm"]

EXPOSE 9000

Create your configuration file

root=postmaster
mailhub=mail.privateemail.com:587
FromLineOverride=YES
rewriteDomain=<YouDomain.com>
AuthUser=<YouEMail@YourDomain.com
AuthPass=<YouUserPass>
UseSTARTTLS=YES
hostname=YourDomain.com

Create a docker-compose

version: 3
  services:
	   php:  yourimage:latest
		   volumes:
			   - ./path/to/your/config:/etc/ssmtp/ssmtp.conf
Authored by
HappyDev
Tags