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

Note Statistics

Note Statistics

  • Viewed 3670 times
  • Bookmarked 1 times
  • 1 Grateful readers
Thu, 08/27/2020 - 21:40

Create Docker file the content below

FROM php:7.4-fpm-alpine

RUN apk update
RUN apk add ssmtp

CMD ["php-fpm"]

EXPOSE 9000

Create your configuration file (ssmtp.conf) with the content below

root=postmaster
mailhub=mail.privateemail.com:587
FromLineOverride=YES
rewriteDomain=<YourDomain.com>
AuthUser=<[email protected]
AuthPass=<YourUserPass>
UseSTARTTLS=YES
hostname=YourDomain.com

Create a docker-compose file with the content below

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