docker-smtp icon indicating copy to clipboard operation
docker-smtp copied to clipboard

mail command

Open matodrobec opened this issue 4 years ago • 0 comments

Hello,

I would like to send mail from app service by using mail command like

echo "hello" | mail -s "test subject" -r [email protected] [email protected]

but this mail is not working.

If I use same mail command from smtp service then I am always get mail to mailbox.

If I use heirloom-mailx then it is working from app service

apt-get install heirloom-mailx
echo "This is the message body and contains the message" | heirloom-mailx -v -r "[email protected]" -s "This is the subject" -S smtp="smpt:25" [email protected]

My swarm configuration

docker stack deploy -c - smtp << EOF
version: '3.7'
services:
  smtp:
    image: namshi/smtp
    networks:
      - smtp
    environment:
      - RELAY_NETWORKS=:192.168.0.0/24:10.0.0.0/16
      - SMARTHOST_ADDRESS=${SMTP_HOST}
      - SMARTHOST_PORT=${SMTP_PORT}
      - SMARTHOST_USER=${SMTP_USER}
      - SMARTHOST_PASSWORD=${SMTP_PASSWORD}
    deploy:
      restart_policy:
          condition: any
      placement:
        constraints:
          - node.role == manager
networks:
  smtp:
    external: true
    name: smtp
EOF


docker stack deploy -c - mailtest << EOF
version: '3.7'

services:
  app:
    image: php7-fpm
    command: tail -f /dev/null
    networks:
      - smtp
    deploy:
      restart_policy:
        condition: any
      placement:
        constraints:
          - node.labels.role == web

networks:
  smtp:
    external: true
    name: smtp

EOF

Test with ssmtp

I try to install ssmtp on the app service but it is not working too.

apt-get install ssmtp

and set set up config like

> cat /etc/ssmtp/ssmtp.conf

root=postmaster
hostname=dc4285ba769a
mailhub=smtp:25

Thank you for help

matodrobec avatar Apr 09 '20 06:04 matodrobec