PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, May 14, 2022

[FIXED] How to send email from docker container to host postfix with bsd-mailx?

 May 14, 2022     docker, mailx, ubuntu     No comments   

Issue

I have a running postfix mailserver on my ubuntu host. I might lateron replace it also with a docker container, but for migration, I want to stick with the host postfix first.

How can I send emails from a docker container to the host postfix, if I want to minimize image size?

I tried installing bsd-mailx inside the container, as is has a small package size.

In general, I could now send emails with: echo "test header" | mail -s "test body" my@mail.com

But how can I tell command in the docker container to actually send the mail to the host system? Or would I have to mount/bind something from the hosts' postfix into the container? So that mailx sends the mail to the mount?


Solution

mail/mailx both invoke a binary called sendmail. That means that you need to install an MTA which is offering that particular interface.

  • postfix
  • exim
  • maybe nullmailer


Answered By - Ralf Hildebrandt
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing