Postfix in LXC - No receive of emails from other domains

I have installed a mail server in a LXC container. I was able to attach FQDN, MX record, A record, SPF record, DKIM record, DMARC record -CORRECTLY and able to send any email to any domain.

But I am unable to receive any email to my server from any other domain. Mydomain to Mydomain receiving /sending of emails- both are working fine .

I tried this also : but no luck.

I am using nginx as proxy server. I also tried to find out any tutorial about using LXC container as mailserver but no good luck.

Anybody can help me in configuring postfix in lxc container or any other way out.

??? why do you want a http proxy for a mail server ???
Get rid of it, a decent mail server is thought out to be able to connect to the internet without proxy. Then when your mail server is listening on port 25 of your container, try to connect from your workstation to the port 25 of your server using telnet or nc. If you don’t get a reply from your Postfix (a 220), it’s very unlikely another mail server will be able to contact your server, you have a network config problem on your server. It it succeed, the problem is probably in your domain config (try dig MX)

nginx can also do TCP proxying. Therefore, you have the choice of setting up nginx as a reverse proxy for TCP connections (mail ports), then use LXD to create a proxy device with proxy_protocol support. Postfix supports the proxy_protocol as well.

I agree with you. But I am using nginx as proxy server for my containers because I have only one dedicated Public IP. By using a proxy server i am converting this dedicated public IP as shared IPs for containers. This gives me more flexibility in administration.
I have checked port 25 and MX record issues but both are working fine .

Hello simos, I have learned most of the LXC from your articles found here and on different forums. I believe your answer is nearest to solution. However, I tried one of your article and caught in this issue which was also a topic on this forum. Link is here .

Exactly what I am trying and failing in?

I have aapanel installed on ubuntu 18.04 (container). I used IP tables to listen default port of aapanel 8888 on Public IP: port. Everything is going good except mail. I can send mail to other domains but can’t get mail from them. My domain to my domain emails are working fine .


The other thread does not mention that your are trying to proxy the SMTP protocol.
As I wrote earlier, to proxy the SMTP protocol you would need to use a TCP proxy instead (not a HTTP/HTTPS proxy).

I am planning on writing a guide on this in the near future. In the meantime, you would need to look at TCP proxying with nginx to solve this issue now.

1 Like

Sir, I am eagerly awaiting for your article