On Mon, Oct 2, 2017 at 5:29 PM, Stephen John Smoogen <smooge at gmail.com> wrote:> On 2 October 2017 at 17:21, Larry Martell <larry.martell at gmail.com> wrote: >> I an running CentOS7 in a docker container. I need to send email from >> that container so I installed sendmail and then I run: >> >> m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf` and when I try and >> send mail it fails with: >> >> larry.martll at gmail.com... Connecting to [127.0.0.1] via relay... >> larry.martll at gmail.com... Deferred: Connection refused by [127.0.0.1] >> >> Anyone know how I can configure sendmail so that I can send mail? > > Does this help any? > > https://stackoverflow.com/questions/26215021/configure-sendmail-inside-a-docker-containerThat post is a bit overwhelming. It has 20+ answers and all are different. I have another container running debian buster and in there I do" yes yes | sendmailconfig and then I can send mail. But I don't see sendmailconfig in CentOS7. Is there an equivalent?
On 2 October 2017 at 18:03, Larry Martell <larry.martell at gmail.com> wrote:> On Mon, Oct 2, 2017 at 5:29 PM, Stephen John Smoogen <smooge at gmail.com> wrote: >> On 2 October 2017 at 17:21, Larry Martell <larry.martell at gmail.com> wrote: >>> I an running CentOS7 in a docker container. I need to send email from >>> that container so I installed sendmail and then I run: >>> >>> m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf` and when I try and >>> send mail it fails with: >>> >>> larry.martll at gmail.com... Connecting to [127.0.0.1] via relay... >>> larry.martll at gmail.com... Deferred: Connection refused by [127.0.0.1] >>> >>> Anyone know how I can configure sendmail so that I can send mail? >> >> Does this help any? >> >> https://stackoverflow.com/questions/26215021/configure-sendmail-inside-a-docker-container > > That post is a bit overwhelming. It has 20+ answers and all are different. > > I have another container running debian buster and in there I do" > > yes yes | sendmailconfig > > and then I can send mail. But I don't see sendmailconfig in CentOS7. > Is there an equivalent?Sendmail is not the standard email server for EL7 so I am a bit rusty here. The item that caught my attention was the following: ------ I figured out a way myself, although not the most elegant solution. I configured the sendmail inside my docker so as to Relay the request via host's ip. Add the following line to the file "/etc/mail/access Connect:<host_ip_here> RELAY Also, in the host as well as docker, comment out the following line in the file "/etc/mail/sendmail.mc" by prefixing it with "dnl #" and suffixing with "dnl". DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') I passed the host ip as an environment variable to the docker container, so that it is configurable. Now the docker's sendmail will relay it's sendmail's smtp request via host machine. ------- Beyond that I am not going to be much help as I have not had much experience with docker. -- Stephen J Smoogen.
On Mon, Oct 2, 2017 at 6:26 PM Stephen John Smoogen <smooge at gmail.com> wrote:> On 2 October 2017 at 18:03, Larry Martell <larry.martell at gmail.com> wrote: > > On Mon, Oct 2, 2017 at 5:29 PM, Stephen John Smoogen <smooge at gmail.com> > wrote: > >> On 2 October 2017 at 17:21, Larry Martell <larry.martell at gmail.com> > wrote: > >>> I an running CentOS7 in a docker container. I need to send email from > >>> that container so I installed sendmail and then I run: > >>> > >>> m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf` and when I try and > >>> send mail it fails with: > >>> > >>> larry.martll at gmail.com... Connecting to [127.0.0.1] via relay... > >>> larry.martll at gmail.com... Deferred: Connection refused by [127.0.0.1] > >>> > >>> Anyone know how I can configure sendmail so that I can send mail? > >> > >> Does this help any? > >> > >> > https://stackoverflow.com/questions/26215021/configure-sendmail-inside-a-docker-container > > > > That post is a bit overwhelming. It has 20+ answers and all are > different. > > > > I have another container running debian buster and in there I do" > > > > yes yes | sendmailconfig > > > > and then I can send mail. But I don't see sendmailconfig in CentOS7. > > Is there an equivalent? > > Sendmail is not the standard email server for EL7 so I am a bit rusty > here. The item that caught my attention was the following: > > ------ > I figured out a way myself, although not the most elegant solution. I > configured the sendmail inside my docker so as to Relay the request > via host's ip. Add the following line to the file "/etc/mail/access > > Connect:<host_ip_here> RELAY > Also, in the host as well as docker, comment out the following line in > the file "/etc/mail/sendmail.mc" by prefixing it with "dnl #" and > suffixing with "dnl". > > DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') > I passed the host ip as an environment variable to the docker > container, so that it is configurable. Now the docker's sendmail will > relay it's sendmail's smtp request via host machine. > > ------- > > Beyond that I am not going to be much help as I have not had much > experience with dockerOk thanks I will try this. But I am not married to sendmail. I will use anything that allows me to send mail from the container.> >