Coder Social home page Coder Social logo

docker-postfix's People

Contributors

baschny avatar dabde avatar dtcooper avatar envy avatar erikmd avatar juanluisbaptiste avatar jvandenbroek avatar linucksrox avatar lucasnz avatar nassoor avatar revsystem avatar scholliyt avatar snyk-bot avatar solidnerd avatar swedishborgie avatar turboaaa avatar virb3 avatar watiko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-postfix's Issues

Simple test example

I like what you have done here.

Can you give a simple example of you to send a test email.

I understand that I could use smtp-mail.outlook.com with my username and password etc.

How do I send a test email?

Feature request: Postfix username + password authentication

Hi,
Is there an easy way to add postfix local authentication?
I want to use this togheter with a Wordpress container, but that needs to point to a smtp server with username and password.

So it becomes like:

--> client (downstream) --> postfix:25 (with local auth) --> external SMTP server (with auth)(upstream)

DNS lookups fail

docker-compose yml

services:
  smtp:
    image: juanluisbaptiste/postfix
    environment:
      SERVER_HOSTNAME: "xxx"
      SMTP_SERVER: 'smtp.mydomain.intranet'
      SMTP_PORT: '587'
      SMTP_USERNAME: 'someuser'
      SMTP_PASSWORD: "secret"
    extra_hosts:
      - "smtp.mydomain.intranet:192.168.5.1"

Describe the issue
postfix cannot resolve the host smtp.mydomain.intranet
I guess this happens due to the issue decribed here: https://serverfault.com/a/1004330

Expected behavior
postfix resolves the host smtp.mydomain.intranet to 192.168.5.1

Add option to enable subject line logging

I just wanted to add an option to enable logging the subject line to help with debugging. I will be following up with a PR.

My idea was to add an ENV variable called LOG_SUBJECT that you set to "yes" to enable subject line logging.

IPv6 subnet format not accepted

Describe the issue

When I want to allow any IPv6 address I use:

environment:
      - "SMTP_NETWORKS=0.0.0.0/0,[::]/0"

Expected behavior

I expect this to be correct, I also tried it as ::/0 but in both cases I get:

[::]/0 is not in proper IPv4 or IPv6 subnet format. Ignoring.

Other subnets that do not work:

[fe80::]/10 is not in proper IPv4 or IPv6 subnet format. Ignoring.
[fd87::]/10 is not in proper IPv4 or IPv6 subnet format. Ignoring.
[::1]/128 is not in proper IPv4 or IPv6 subnet format. Ignoring.

This has something to do with the regex being performed. Is there any workaround or can this bug be solved?

main.cf missing

Hey,
On startup of this container it states /etc/postfix/main.cf is missing, is there something I'm missing?

Thanks

SMTP Header Checks Multiple Regex

Is there a way to add multiple regex's to the smtp_header_checks file? I see there is a way to add OVERWRITE_FROM as an option, but I have a separate regex I also need to add to the smtp_header_checks file.

REQ: OVERWRITE_TO

similar to the OVERWRITE_FROM option, OVERWRITE_TO would rewrite all TO: fields so that all email passing through goes to a single endpoint. would be useful to me for a home lab environment where several hosts on the LAN are reporting out through a single SMTP relay.

Send a Test Email

hi, thank you for the image.

New Feature: is there a way to test postfix functionality like to 'Send a Test email' from postfix

Security problem with Alpine

Hi Juan ,

Just to let you know that the alpine 3.13.1 has a critical problem on the python (CVE-2021-3177 ).

Found using trivy :

trivy image --severity HIGH,CRITICAL juanluisbaptiste/postfix
2021-03-07T19:36:55.803+0100 WARN You should avoid using the :latest tag as it is cached. You need to specify '--clear-cache' option when :latest image is changed
2021-03-07T19:36:57.665+0100 INFO Detecting Alpine vulnerabilities...
2021-03-07T19:36:57.666+0100 INFO Trivy skips scanning programming language libraries because no supported file was detected

juanluisbaptiste/postfix (alpine 3.13.1)

Total: 7 (HIGH: 6, CRITICAL: 1)

+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
| libcrypto1.1 | CVE-2021-23839 | HIGH | 1.1.1i-r0 | 1.1.1j-r0 | openssl: incorrect SSLv2 |
| | | | | | rollback protection |
| | | | | | -->avd.aquasec.com/nvd/cve-2021-23839 |

  •          +------------------+          +                   +               +---------------------------------------+
    

| | CVE-2021-23840 | | | | openssl: integer |
| | | | | | overflow in CipherUpdate |
| | | | | | -->avd.aquasec.com/nvd/cve-2021-23840 |

  •          +------------------+          +                   +               +---------------------------------------+
    

| | CVE-2021-23841 | | | | openssl: NULL pointer dereference |
| | | | | | in X509_issuer_and_serial_hash() |
| | | | | | -->avd.aquasec.com/nvd/cve-2021-23841 |
+--------------+------------------+ + + +---------------------------------------+
| libssl1.1 | CVE-2021-23839 | | | | openssl: incorrect SSLv2 |
| | | | | | rollback protection |
| | | | | | -->avd.aquasec.com/nvd/cve-2021-23839 |

  •          +------------------+          +                   +               +---------------------------------------+
    

| | CVE-2021-23840 | | | | openssl: integer |
| | | | | | overflow in CipherUpdate |
| | | | | | -->avd.aquasec.com/nvd/cve-2021-23840 |

  •          +------------------+          +                   +               +---------------------------------------+
    

| | CVE-2021-23841 | | | | openssl: NULL pointer dereference |
| | | | | | in X509_issuer_and_serial_hash() |
| | | | | | -->avd.aquasec.com/nvd/cve-2021-23841 |
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
| python3 | CVE-2021-3177 | CRITICAL | 3.8.7-r0 | 3.8.7-r1 | python: stack-based buffer overflow |
| | | | | | in PyCArg_repr in _ctypes/callproc.c |
| | | | | | -->avd.aquasec.com/nvd/cve-2021-3177 |
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+

Add 127.0.0.0/8 to mynetworks

I am using this container in podmans pod, which share infrastructure for networking, so connections appear to be localhost. If the allowed network doesn't contain 127.0.0.1 the unauthecated TCP connection was not allowed. The network range could be modified not to include all the IP addresses.

mynetworks = 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8

I hope it's clear, I can share more details from my setup, if it's necessary.

DNS connectivity issue

After starting a container from this image there is an issue related to DNS
I even put the right record in container /etc/hosts with no results
Out of the box is giving the same error as below but complains about ipv6 DNS (type=AAAA)
I can rebuild the image using inet_interfaces = ipv4 but I don't think it will help.

There is an issue related to resolver, the result is the same even i start the container with parameter --dns 8.8.8.8
postfix/smtp[120]: E05DB1A1220: to=[email protected], relay=none, delay=5, delays=0.01/0.01/5/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=smtp.sendgrid.net type=A: Host not found, try again)

I have reloaded postfix inside container and when trying to send an email (through sendgrid) I get the above error.
Why this is happening since the domain is reachable?
``bash-5.1# nslookup smtp.sendgrid.net
Server: 8.8.8.8
Address: 8.8.8.8:53

Non-authoritative answer:
Name: smtp.sendgrid.net
Address: 54.228.39.88
Name: smtp.sendgrid.net
Address: 18.197.194.208
Name: smtp.sendgrid.net
Address: 52.57.139.126
Name: smtp.sendgrid.net
Address: 108.128.229.184

Non-authoritative answer:
``

[alpine] SASL authentication failure: No worthy mechs found

tag with latest works fine. while alpine will not work with same config.

Mar 31 09:09:30 538f84b25f17 postfix/smtpd[97]: connect from wiki[10.0.2.3]
Mar 31 09:09:30 538f84b25f17 postfix/smtpd[97]: 2437A1A3CC0: client=bookstack.wiki[10.0.2.3]
Mar 31 09:09:30 538f84b25f17 postfix/cleanup[100]: 2437A1A3CC0: message-id=<28d2899d457986ba836ef47ca80aefbe@_>
Mar 31 09:09:30 538f84b25f17 postfix/qmgr[95]: 2437A1A3CC0: from=<[email protected]>, size=11492, nrcpt=1 (queue active)
Mar 31 09:09:30 538f84b25f17 postfix/smtpd[97]: disconnect from wiki[10.0.2.3] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Mar 31 09:09:30 538f84b25f17 postfix/smtp[101]: warning: SASL authentication failure: No worthy mechs found
Mar 31 09:09:30 538f84b25f17 postfix/smtp[101]: 2437A1A3CC0: to=<[email protected]>, relay=smtp2.xxx.xx[172.20.1.100]:587, delay=0.12, delays=0.01/0.03/0.08/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp2.xxx.xx[172.20.1.100]: no mechanism available)

Getting the domain from the server host name

This isn't so trivial as there are some cases like polish regional domains (eg. $DOMAIN.waw.pl) which should be interpreted as a whole, not just waw.pl (as this will not work correctly). This is something to consider as it currently forces me to do a workaround

DNS Wildcard Problem

The following line of code is broken when you have a domain like: mail.adbc.com.pt, mail.abcd.com.br

DOMAIN=echo ${SERVER_HOSTNAME} | awk 'BEGIN{FS=OFS="."}{print $(NF-1),$NF}'

The result becomes: com.pt or com.br which is not what we prettend to use

Postfix cannot find \/etc\/postfix\/sasl_passwd

Since recreating the postfix container (after a pull) I cannot send emails anymore, which used to work with the exact same settings.

The /var/log/maillog shows that Postfix cannot find the password file:

postfix_1    | Mar 10 16:51:58 ac84ee08fcbb postfix/smtp[156]: warning: hash:\/etc\/postfix\/sasl_passwd is unavailable. open database \/etc\/postfix\/sasl_passwd.db: No such file or directory

I think the recent merge of #7 has caused this: postconf doesn't appear to unescape the \/, whereas sed probably did. When I manually change the line

smtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd

to

'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

(and not restart the container!) emails are sent again, including ones in the queue.

Sending e-mail without getting blocked

This issue is not specific to this Docker image, but it happens because of Postfix and I really hope I can find a solution.

I want to use this project to send verification e-mails through a newly created e-mail account. I tried Gmail, Outlook, even Yandex Mail. Unfortunately, each one of them detects Postfix as a spam/bot, and requests phone verification to proceed, something I want to avoid. If I use a mainstream e-mail client like Outlook, everything works, which leads me to believe that it is something specific to Postfix they are detecting. Do you know how I could bypass this detection?

Thank you

Can not build on arm32v7

Trying to use this on Raspberry Pi.
But get No package epel-release available. error when trying to build the docker image on Raspberry Pi.

451 4.3.2 Internal server error (in reply to RCPT TO command))

I try to use this postfix relay docker to do the smtp relay for redmine.

But I found the e-mail can't send out, and it returns 451 4.3.2 Internal server error (in reply to RCPT TO command)) .

Can anyone help me to solve this problem.

BTW, the smtp server is a Chinese local smtp service supplier.

Add support for setting arbitrary postfix configuration values

Situation

Postfix has a lot of options and it is hard/impossible to support all of them in the image.
However, we can add rather generic support for any kind of option the following way.

Looking for POSTFIX_* and setting it

I suggest to add to run.sh something on the line of:

for var in $(set | grep POSTFIX_); do
   keyname=${var#POSTFIX_}
   eval value=\$$var
  postconf -e "$keyname = $value"
done

This should work for arbitrary values .

Postfix does log to to stdout

It seems that postfix is supposed to be logging to /var/log/supervisor/postfix.log , which then should be accessible by using "docker logs $containername". The postfix.log file does not seem to be populated with log data.

I can't find any documentation that shows postfix can log to a file. It seems to only use syslog. I'm trying to troubleshoot an issue because my mail does not seem to be getting relayed. Log files would be helpful in troubleshooting.

Support CentOS 8 and a supervisor alternative

The build is currently failing. Apparently supervisor is not available:

$ docker build --tag docker-postfix .
Sending build context to Docker daemon  122.4kB
Step 1/13 : FROM centos:latest

[...]

Installed:
  libxkbcommon-0.8.2-1.el8.x86_64       diffutils-3.6-5.el8.x86_64
  kbd-2.0.4-8.el8.x86_64                xkeyboard-config-2.24-3.el8.noarch
  kbd-legacy-2.0.4-8.el8.noarch         kbd-misc-2.0.4-8.el8.noarch

Complete!
Last metadata expiration check: 0:00:47 ago on Wed Oct 16 23:02:49 2019.
No match for argument: supervisor
Error: Unable to find a match
The command '/bin/sh -c yum install -y epel-release && yum update -y &&     yum install -y cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5 mailx     perl supervisor postfix rsyslog     && rm -rf /var/cache/yum/*     && yum clean all' returned a non-zero code: 1

If I find a fix I'll report back, but I thought I should note the problem first.

Postfix can't send email to the same domain name email address (G Suite)

Using GMail for my G Suite account, for example mydomain.com below, I run the container with the following environment variables:

SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
[email protected]
SMTP_PASSWORD=topsecret
SERVER_HOSTNAME=mydomain.com

Now if try to send an email to [email protected], I get the following error,

Oct 11 02:55:23 c2068577d527 postfix/smtpd[96]: NOQUEUE: reject: RCPT from carb_admin_run_1bc21d8a4fd6.carb_default[****]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<[****]>

Per the Postfix documentation on mydestination, it should contain the list of domains whose emails are hosted on the local Postfix server so that they are handled internally and not relayed out to external systems. Since the container is not using Postfix to receive mail, we should set mydestination to localhost only.

So line 32 in run.py should be changed from,

add_config_value "mydestination" '$myhostname'

to

add_config_value "mydestination" 'localhost'

Thanks!

SMTP_NETWORKS doesn't work unless container is run in host mode?

Hey thanks for this image, I've been using it a lot recently! Much appreciated. :-)

Perhaps I'm missing something, but I believe that SMTP_NETWORKS doesn't work as currently described.

Unless the container is running in host mode, Postfix sees all requests as coming from the Docker host.

For example, when I connect and send email from a public IP, Postfix sees the connection as coming from 10.0.0.2, eg.

Dec 05 23:51:26 postfix postfix/smtpd[103]: connect from unknown[10.0.0.2]
Dec 05 23:51:36 postfix postfix/smtpd[103]: ECE5A38BD43: client=unknown[10.0.0.2]
Dec 05 23:51:44 postfix postfix/cleanup[107]: ECE5A38BD43: warning: header Subject: blasdhkf adslkfjads lfka sjdfklasf from unknown[10.0.0.2]; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<foo>

This means that anyone who exposes port 25 to the world is creating an open relay.

Permission denied when mounuting /var/spool/postfix

Hi,
I'm trying to mount /var/spool/postfix on the host but even when i set chmod 777 postfix won't start because of Permission Denied error.
To mount this folder i've just added this option on docker run command :

podman run -d \
        --name postfix \
        -v /home/centos/postfix/data/spool:/var/spool/postfix \
        ....

And the output displays :

ls: can't open '/var/spool/postfix': Permission denied
cp: can't create directory '/var/spool/postfix/active': Permission denied
cp: can't create directory '/var/spool/postfix/bounce': Permission denied
cp: can't create directory '/var/spool/postfix/corrupt': Permission denied
cp: can't create directory '/var/spool/postfix/defer': Permission denied
cp: can't create directory '/var/spool/postfix/deferred': Permission denied
cp: can't create directory '/var/spool/postfix/flush': Permission denied
cp: can't create directory '/var/spool/postfix/hold': Permission denied
cp: can't create directory '/var/spool/postfix/incoming': Permission denied
cp: can't create directory '/var/spool/postfix/maildrop': Permission denied
cp: can't create directory '/var/spool/postfix/pid': Permission denied
cp: can't create directory '/var/spool/postfix/private': Permission denied
cp: can't create directory '/var/spool/postfix/public': Permission denied
cp: can't create directory '/var/spool/postfix/saved': Permission denied
cp: can't create directory '/var/spool/postfix/trace': Permission denied

I use alpine image.
Should i do something specific to make it work ?

Container not starting.

Hi,

I am trying to setup the outgoing notifications of OTRS with de Postfix container but the container is not starting and the logs tells me:

SMTP_SERVER is not set

Everything is set it up in the .env file.

How can I work around this?

Thanks.

Github actions release action is broken

Describe the issue
Github Release workflow is not working, the release workflow is not triggering after a PR is merged with the correct feature:, fix: or BREAKING_CHANGE: semantic versioning tags. The git tag and the github release are not being created.

As a workaround, the tag needs to be manually created to trigger the release workflow to create the docker hub tag, but the github release is still not working and it needs to be created manually.

Expected behavior
The tag and github releases should be automatically created when a PR that adheres to the semantic versioning rules is merged.

A possible solution is to update the github action components to a more recent version.

License for the project ?

Hello and thank you for your work.

We would like to use your image, however we could not find any licensing information.

If you intended for your work to be open source, you can add a license in your README, or a separate license file. Github has a great choose your licence page https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository.

If you want to retain copyright, it would be helpful if the README contained a copyright notice.

SMTP with TLS is not enabled

Discussed in #100

Originally posted by natasha1234567890 June 12, 2023
SMTP with TLS is not really enabled as you can see from capabilities advertised by the server.
There should be '250-STARTTLS'

How can I enable TLS?

nh@helenubuntu:~/docker-postfix$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mailhog.example ESMTP MailHog
ehlo kk
250-Hello kk
250-PIPELINING
250 AUTH PLAIN
quit
221 Bye

Overwrite Sender Header

Hello!
I ran into the problem of sending mail via smtp.yandex.ru. This service requires the From and Sender headers to match. For example i get: "Sender: root@e379890e3f75" and "550 5.7.0 Sender or From header address rejected: not owned by authorized user". Now I am creating my dockerfile based on your image. I add this line run.sh:
echo -e "/^Sender:.*$/ REPLACE Sender: $OVERWRITE_FROM" >> /etc/postfix/smtp_header_checks
Can you add a variable to duplicate the From and Sender headers?

OVERWRITE_TO - All emails to one recipient

Hey,

is it possible to overwrite the recipient of all mails like the "OVERWRITE_FROM" env var? It would be perfect for testing purposes and security with private homeservers.

Best regards
Jens

Docker image for Raspberry Pi

I noticed that there's only an amd64 image of this container on Docker Hub.

I just checked out the migrate_to_alpine branch, built the container with docker build -t postfix . and I can confirm that the resulting container just works on a Raspberry Pi running Raspbian 10.3. Could you also publish arm builds of the image to Docker Hub?

Example of how to use it as a smtp server

What I mean with this is that I want to use this image to send emails with a web page in localhost, I've configured the image like this:

sudo run --name postfix -p "25:25" --net=host -e SMTP_SERVER=localhost -e SMTP_USERNAME=andres -e SMTP_PASSWORD=password -e SERVER_HOSTNAME=127.0.0.1 -e SMTP_NETWORKS='192.168.0.0/24' juanluisbaptiste/postfix

And then, I use node.js as a client, with the Nodemailer library, like this:

const nodemailer = require("nodemailer");

const transporter = nodemailer.createTransport({
  host: "localhost",
  port: 25,
  auth: {
    user: "andres",
    pass: "password"
  },
  secure: false
});

transporter.sendMail({
  from: "[email protected]",
  to: "[email protected]",
  subject: "Hello โœ”",
  text: "Hello world?",
  html: "<b>Hello world?</b>"
});

But it doesn't work, the error that nodemailer throws me is:

Screenshot_2019-08-28_17-20-52

Might you help me? Thank you!

Error building alpine image

Hi,

I can't build alpine image, i've got this error :

$ podman build .
STEP 1: FROM alpine
--> Using cache b3b48f001ff6d8634c699b1ea2547db81459a6399612499ec9784d0ecd6c8e95
--> b3b48f001ff
STEP 2: RUN apk update &&     apk add bash gawk cyrus-sasl cyrus-sasl-plain cyrus-sasl-login cyrus-sasl-crammd5 mailx     perl supervisor postfix rsyslog &&     rm -rf /var/cache/apk/* &&     mkdir -p /var/log/supervisor/ /var/run/supervisor/ &&     sed -i -e 's/inet_interfaces = localhost/inet_interfaces = all/g' /etc/postfix/main.cf
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
v3.13.0-6-gc9c6964928 [https://dl-cdn.alpinelinux.org/alpine/v3.13/main]
v3.13.0-10-gb379e70abc [https://dl-cdn.alpinelinux.org/alpine/v3.13/community]
OK: 13870 distinct packages available
ERROR: unable to select packages:
  cyrus-sasl-plain (no such package):
    required by: world[cyrus-sasl-plain]
Error: error building at STEP "RUN apk update &&     apk add bash gawk cyrus-sasl cyrus-sasl-plain cyrus-sasl-login cyrus-sasl-crammd5 mailx     perl supervisor postfix rsyslog &&     rm -rf /var/cache/apk/* &&     mkdir -p /var/log/supervisor/ /var/run/supervisor/ &&     sed -i -e 's/inet_interfaces = localhost/inet_interfaces = all/g' /etc/postfix/main.cf": error while running runtime: exit status 1

Have i missed something or is it a version problem ?

smtp_tls_security_level without port 465?

Hi there,

I have recently set up your container to work as a relay to Office365 Mail/Exchange Online. In doing so, I found that the smtp_tls_security_level setting was required, but both without smtp_tls_wrappermode and not on port 465.

docker-postfix/run.sh

Lines 41 to 44 in 9b1d5b4

if [ "${SMTP_PORT}" = "465" ]; then
add_config_value "smtp_tls_wrappermode" "yes"
add_config_value "smtp_tls_security_level" "encrypt"
fi

Would you be willing to accept a PR to add an environment variable to set smtp_tls_security_level?

Also, per the Postfix docs, smtp_tls_security_level should be used in place of smtp_use_tls for Postfix 2.3 and above. I commented this out with no ill effect (I believe smtp_tls_security_level implies smtp_use_tls), but I don't have anywhere to test this...

Domain transport limit

As a company request my postfix needs to be limited to send emails to certain specific domains.
In the traditional instalation this can be achieved adding this to the main.cf at the end of the file:
transport_maps = texthash:/etc/postfix/transport

Then you need to edit /etc/postfix/transport and add something like this:
example.com smtp:
* error:only mail to example.com will be delivered

The question is, how this can be achieved via variables, is it possible?

Thanks

Is supported TLS encryption(Let's Encrypt) and submission port?

Is this docker-postfix supported TLS encryption and submission port(587/tcp) with let's encrypt?
If yes, I think run.sh is missing config value like below.

add_config_value "smtpd_tls_cert_file" "/etc/postfix/signed.crt"
add_config_value "smtpd_tls_key_file" "/etc/postfix/domain.key"
add_config_value "smtpd_tls_security_level" "may"

Maybe these parameters are needed for Let's Encrypt and submission port.

How to get container X to send all mail via the postfix container

@juanluisbaptiste We're nearing the end of "Dockerising" a legacy application.

The application uses Mailgun in itself to send emails, but we need to get the emails from any cron output (fatal errors etc.) sent out.

I am hoping we can do this with your docker-postfix image. I've got it running and sending email via Mailgun from itself, but have no idea how to configure the main application PHP container to route any emails cron would send via the postfix container.

Is this something you can advise on?

Our redacted Docker Compose file is as follows...

version: '2'

networks:
  application-network:

volumes:
  mysql:
    driver: local

services:

  mysql:
    image: mysql:5.5.58
    environment: &mysql_env
      XXXXXXXXXX
    restart: always
    volumes:
      - mysql:/var/lib/mysql
    networks:
      application-network:
        aliases:
         - XXXXXXXXXX

  php-apache:
    build:
      context: ../
      dockerfile: dockerfile/php-apache
    image: XXXXXXXXXX-php-apache-5.6.32:v1.1.1
    restart: always
    environment:
      <<: *mysql_env
    volumes:
      XXXXXXXXXX
    ports:
      - 33040:80
    depends_on:
      - mysql
      - postfix
    networks:
      application-network:

  postfix:
    image: juanluisbaptiste/postfix:latest
    expose:
      - 25
    environment:
      SMTP_SERVER: smtp.mailgun.org
      SMTP_USERNAME: postmaster@XXXXXXXXXX
      SMTP_PASSWORD: XXXXXXXXXX
      SERVER_HOSTNAME: XXXXXXXXXX
    networks:
      application-network:

Please Help -Error - host smtp.gmail.com [173.194.220.108] refused to talk to me: 521 connection rejected.

I was able to get the docker-image and set it up and running using gmail smtp. However, the email isn't sending. Please what do I do. I am thinking It probably has to do with IP but I have tried 3 different ISPs and had the same response. Please I need some help.
Here is my docker-compose.yml

services:
  postfix:
    image: juanluisbaptiste/postfix:alpine
    expose:
    - "25"
    env_file:
      - .env
    restart: always
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
    networks:
      postfix:
networks:
  postfix:
    name: postfix

The reply below is what I got from the inspect log on my docker desktop.


Aug 24 10:35:31 3237f1bfd0cc postfix/smtpd[103]: 95A0C4A4C: client=case-tracker_wordpress_1.postfix[172.21.0.3]

Aug 24 10:35:31 3237f1bfd0cc postfix/cleanup[106]: 95A0C4A4C: message-id=<[email protected]>

Aug 24 10:35:31 3237f1bfd0cc postfix/smtpd[103]: disconnect from case-tracker_wordpress_1.postfix[172.21.0.3] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5

Aug 24 10:35:31 3237f1bfd0cc postfix/qmgr[93]: 95A0C4A4C: from=<[email protected]>, size=3586, nrcpt=1 (queue active)

Aug 24 10:35:32 3237f1bfd0cc postfix/smtp[107]: 95A0C4A4C: to=<[email protected]>, relay=smtp.gmail.com[173.194.220.108]:587, delay=0.97, delays=0.06/0.01/0.77/0.13, dsn=5.5.0, status=bounced (host smtp.gmail.com[173.194.220.108] said: 550 5.5.0 Invalid EHLO/HELO domain. (in reply to MAIL FROM command))

Aug 24 10:35:32 3237f1bfd0cc postfix/cleanup[106]: B5F594A50: message-id=<[email protected]>

Aug 24 10:35:32 3237f1bfd0cc postfix/bounce[108]: 95A0C4A4C: sender non-delivery notification: B5F594A50

Aug 24 10:35:32 3237f1bfd0cc postfix/qmgr[93]: B5F594A50: from=<>, size=5596, nrcpt=1 (queue active)

Aug 24 10:35:32 3237f1bfd0cc postfix/qmgr[93]: 95A0C4A4C: removed

Aug 24 10:35:33 3237f1bfd0cc postfix/smtp[107]: B5F594A50: to=<[email protected]>, relay=smtp.gmail.com[173.194.220.108]:587, delay=0.9, delays=0.01/0/0.86/0.03, dsn=5.5.0, status=bounced (host smtp.gmail.com[173.194.220.108] said: 550 5.5.0 Invalid EHLO/HELO domain. (in reply to MAIL FROM command))

Aug 24 10:35:33 3237f1bfd0cc postfix/qmgr[93]: B5F594A50: removed

Aug 24 10:36:32 3237f1bfd0cc postfix/qmgr[93]: C03264A3D: from=<[email protected]>, size=3586, nrcpt=1 (queue active)

Aug 24 10:36:33 3237f1bfd0cc postfix/smtp[107]: C03264A3D: to=<[email protected]>, relay=smtp.gmail.com[173.194.220.108]:587, delay=572, delays=571/0/0.45/0, dsn=4.0.0, status=deferred (host smtp.gmail.com[173.194.220.108] refused to talk to me: 521 connection rejected)

Aug 24 10:46:32 3237f1bfd0cc postfix/qmgr[93]: C03264A3D: from=<[email protected]>, size=3586, nrcpt=1 (queue active)

Aug 24 10:46:34 3237f1bfd0cc postfix/smtp[111]: C03264A3D: to=<[email protected]>, relay=smtp.gmail.com[173.194.220.108]:587, delay=1173, delays=1171/0.02/1.8/0, dsn=4.0.0, status=deferred (host smtp.gmail.com[173.194.220.108] refused to talk to me: 521 connection rejected)

Please any help or pointers as to what might be happening?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.