Report this

What is the reason for this report?

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

Posted on March 28, 2021

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 main.cf 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/main.cf

inet_interfaces = loopback-only
relayhost = [smtp.eu.mailgun.org]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:mail@adress:password
smtp_sasl_security_options = noanonymous


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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:

mxa.mailgun.org
mxb.mailgun.org

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.

Regards, KFSys

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?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.