So, I have read through several articles and tutorials, but I could not find the solution of my problem.
First of all, in local development environment I am successfully testing emails with mailtrap.io
and Lumen 5.7
Here is my .env
in local development environment :
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=XXXXXXXXXXXXXX
MAIL_PASSWORD=XXXXXXXXXXXXXX
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="Example app"
It is working fine.
When I am trying to send emails on my Amazon EC2 - Ubuntu 18.04
with Lumen, First, I have installed postfix
and configured successfully and tested with mailtrap.io
, it works fine with mail
command from mailutils
.
In this situation I have changed my .env
configurations as follows :
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="Example app"
So basically I am trying to send emails in the following manner (From > To):
Lumen > Postfix > Mailtrap
But it is not working ! I have checked /var/log/mail.log
to check for errors, but logging doesn't even triggered. Where am I doing wrong?
Help from experts would be appreciated.