Postfix and Mailgun on Ubuntu 18.04 (Emails are going but not coming)

Posted March 28, 2021 235 views
Ubuntu 18.04

Hello to everyone, i can send mail via Mailgun with the method below. However, when i use this method, i am unable to receive e-mails.

The problem disappears when i re-edit the file…
I want to send mail with Mailgun and be able to see incoming emails. How can i solve this problem?

The method i apply:

nano /etc/postfix/

inet_interfaces = loopback-only
relayhost = []:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:mail@adress:password
smtp_sasl_security_options = noanonymous
edited by KFSys
1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
4 answers

Hi @Murtooo,

Can you please confirm where exactly do you wish to receive the mails? Is it on your droplet or with Mailgun on your account?

I’m asking as it’s different answer based on what your needs are.

For instance, if you want to receive messages with mailgun Yyur domain needs Mailgun MX records to handle inbound messages. You’ll need to change your DNS records - MX record to be the one of mailgun:

If you want to receive messages on your droplet, then you’ll need to install Postfix + Dovecot which can proove a lot more difficult than the first option.


Postfix + Dovecot installed. I’m using Webmin. My mx records as you said.
My goal: I want to read mails from Roundcube. I want to send mail with Mailgun.

I still haven’t found the source of the problem. Does anyone have an idea?

I still did not fix the problem. Is there anyone who can help?