Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
2.8k views
by Talented

Lat time I had this problem you answered as follows -- https://webinoly.com/support/2706/cant-receive-email-sent-from-the-same-domain?show=2751#a2751

This time, all I have done with the email is I have installed Webinoly, and then issued the following command... (obfuscated before posting)

sudo webinoly webinoly -smtp=[email-smtp.eu-west-2.amazonaws.com,AKIA4K47875HJODXLDEGQXR,BCVhpp9fG34Dd8c37x587fz49mkx8AGm+2geI3dKkqQK9C,licencedbreeders.uk]

When no email was arriving I checked and I find that the postfix configuration looks like this again... 

mydestination = licencedbreeders.uk, localhost.uk, localhost

I can only assume that this was the problem last time. 

In setting up the SMTP server we (me and Webinoly) have also misconfigured postfix again.

Cristhian, can you check this please.

Terence.

by Talented
Once I removed my domain from the "mydestination=" list everything works as expected.
by Expert
Hi Terence,

Are you saying that you always get the domain name in "mydestination" after SMTP is configured with Webinoly?

Actually, yesterday I was using this command in a new server and I'm taking a look right now and everything is fine. The only thing that comes to my mind is that maybe the default postfix "main.cf" file is different depending on the cloud provider, sounds crazy but it's possible. Would be useful if you help me to debug this issue, check this file before and after Webinoly.
by Talented

Well I have done it twice and got the same result on both occasions. The first time it was on DigitalOcean and the second time was on Vultr.

I could do...

sudo webinoly -smtp -purge

check the config file/s, then configure the SMTP again, and see what happens?

Anything else you want me to check?

by Expert
Yes, you can do that!

Check the "mydestination" value before and after, please.
by Talented

Once I purged the SMTP it looked like this...

Then when I used the command similar to this...

sudo webinoly webinoly -smtp=[email-smtp.eu-west-2.amazonaws.com,AKIA4K47875HJODXLDEGQXR,BCVhpp9fG34Dd8c37x587fz49mkx8AGm+2geI3dKkqQK9C,licencedbreeders.u]

Then the main.cf file reverted to this...

So I had to remove my domain again so it would work.

It looks like the misconfiguration is coming from the SMTP setup line, as published in the docs.

 

by Expert

Ok. Now the thing is, why your domain is included in the default postfix file?

Let me explain some things to try to understand how to debug this issue:

  • Webinoly installs Postfix from the original source and we leave all the default values, we don't touch any file. Ok?
  • We save a copy of the "main.cf" file because we need it when people want to purge the SMTP, this way we can recover the original (default) configuration.
So, the question is, when is the domain added to this file?
Who is adding this domain in Postfix?
The only thing I can suggest is that you should do a clean installation in a new server and see this file after every step. Check inmediately after Webinoly stack is build and after every step after that.
I use it yesterday and everything is fine, so I'm pretty sure that is something particular of your configuration.
by Talented
Either that or I have misunderstood the meaning of "mainhost" ?
by Talented
I don't see how that resolves the issue.

The mainhost domain was not in the config until I set it up for SMTP; then when I purged the SMTP config it was removed. Then when I set it up for SMTP again it was back. What difference will setting up another server make?
by Expert

After you purged the SMTP you are seeing the original default configuration file that comes with Postfix. That file is saved (a copy) by Webinoly immediately after Postfix is installed on your server.

Why is your domain there?

That's the question!

by Expert
Just to clarify, Postfix is installed since the beginning when the complete stack is built, that's why is a surprise that your domain is included in the default file.

2 Answers

+1 vote
by Expert

I think I have found the cause of this issue.

Postfix will always use your local machine name (hostname) in the default configuration. Seems like at some point before installing Webinoly you are naming your server with the same name as your domain.

Please, confirm this, just run "hostname" in your terminal or see inside /etc/hostname.

by Talented

At Vultr I created a new instance named licencedbreeders.com

I set up Route 53 to point the licencedbreeders.com A record at 95.179.230.43

I checked the hostname -- it had been set to "licencedbreeders.com" by the Vultr install script

I checked for /etc/postfix/main.cf -- it didn't exist

Then I ran "sudo apt update && sudo apt upgrade"

Then I installed Webinoly with -- "wget -qO weby qrok.es/wy && sudo bash weby 3"

****************************************************************************
******    INSTALLATION HAS FINISHED SUCCESSFULLY     ******
****************************************************************************

I then checked the variables in the /etc/postfix/main.cf config file and they looked like this...

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

myhostname = licencedbreeders.com

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

mydestination = , $myhostname, licencedbreeders.com, localhost.com, localhost

relayhost =

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

mailbox_size_limit = 0

recipient_delimiter = +

inet_interfaces = all

inet_protocols = all

So, right from the get-go, to send mail, the postfix/main.cf will have to be edited to remove the hostname/domain entry.

This is the third time this has happened so reproducable and its pretty conclusive, as far as I am concerned.  

If the hostname is defined in the server install script, the Webinoly install script is putting the hostname into the postfix/main.cf variables.

What other explanation could there be?

by Expert

That's exactly what I tried to explain in my answer:

https://webinoly.com/support/3056/same-postfix-problem-again?show=3111#a3111

"Postfix will always use your local machine name (hostname) in the default configuration."

by Talented
I guess I am just misunderstanding the primary role for using Postfix then, since that immediately means that in the default configuration, no mail will leave the server.
by Expert
That's only true if you are naming your hostname the same as your domain. The logic behind Postfix is simple, if an email is sent to your "home" domain, they don't need to leave the server, because they are already there at "home" (hostname).
by Talented
edited by
Brain dead.

What if Google had thought like that with gmail.com?

Oh well, different time and era I guess.

Or again, maybe, just a lack of understanding on my part.
0 votes
by Expert
This issue has been fixed in v1.11.0, released today.
by Talented
I know. Cool beans!
Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...