Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mail command #66

Open
matodrobec opened this issue Apr 9, 2020 · 0 comments
Open

mail command #66

matodrobec opened this issue Apr 9, 2020 · 0 comments

Comments

@matodrobec
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant