So I have this weird issue with mail notifications. I have deployment on Amazon Elastic Beanstalk, and I am using Amazon SQS as queueing service. For mail I am using Mailgun. Now the problem is when the mail notification is queued and processed it fails.
And here is the interesting part, when I send an email notification that is not queued, it is sent correctly, and after that the queue emails are sent as well for sometime and then again they start to fail.
I've added SerializeModels trait to notifications as well. However it does not work until I send one email that is not queued.
My User class has also properly implemented the method routeNotificationForMail and is returning the user's email.
Anyone faced similar issue?
##EDIT
So I have drilled it down to where the problem is, the worker process running in systemd is somehow unable to translate or transfer the environment variables from file /opt/elasticbeanstalk/deployment/env. Now when I run this in terminal the queue is processing just fine. But when the queue worker is restarted nothing works.
I am using the EnvironmentFile=/opt/elasticbeanstalk/deployment/env in my laravel_worker.service
Does anyone have any idea how I can go about this?