Hi everyone. I'm testing my store on Magento 2.1.5 CE on a local virtual machine with enough resources and have noticed an annoying thing, that is, when ever I send an email to the customer from the backend, for instance "Send Email" button from orders or from invoices, everywhere it behaves the same. When I click the button, it waits and waits and waits, just like when a page takes very long time to load, and after a minute it is done ok. I've checked the emails and they have all arrived, but the behaviour gives me a very bad feeling.
From what I've googled around, I've found out that emails are not sent directly when you click the button, but they are placed in a queue, and they wait there until the cron job doesn't pick them up. Which is totally ok, because if that email is sent now or 1 min later it is the same thing, but the crucial problem here is that the backend hangs (freezes) from the time when you click the button till it sends the email (cca. 1 min later).
So I wonder, if I've setup something wrong or is this normal behaviour, well I hope it's not
Any suggestion much welcome, thanks.
Hi. It turned out that it was not Magento fault, but my bad web server configuration I tried to manually send the mail from CLI of webserver like so:
echo "Subject:test" |sendmail firstname.lastname@example.org
and it was waiting a whole minute before the command completed it self and actually sent the mail, so I checked the logs in /var/log/mail.log and saw this:
unable to qualify my own domain name (websrv4) -- using short name
so I went and edit the /etc/hosts file from this:
127.0.0.1 localhost 127.0.1.1 websrv4
to look like this:
127.0.0.1 localhost localhost.localdomain 127.0.1.1 websrv4.localdomain websrv4
And the emails are now send instantly. Hope this helps someone else