James Star
James Star

Reputation: 85

Laravel Lumen Mail and Amazon SES 500 Internal Server Error on Ubuntu Server (Production)

Spent a good deal of time reviewing this...

What I've double, triple checked and against existing Stack Overflow current issues:

Everything works fine on localhost.. perfect

Set everything up on Ubuntu, fails. If I comment out the Mail part, I get the response message that would come directly after the Mail lines of code.

I'm thinking whether it has anything to do with pointing to the public folder and then the route?

www.domain.com/api/public/routename

Also, my domain is managed by AWS Route 53 and points to a Digital Ocean Ubuntu Server IP address.

Any ideas appreciated. Thank you!

Upvotes: 1

Views: 938

Answers (2)

Muhammad Mubashir
Muhammad Mubashir

Reputation: 174

In my case i had to change MAIL_ENCRYPTION to ssl in my .env and by the way if your ses is in sandbox then you will have to verify both sender email and receiver email

Upvotes: 1

James Star
James Star

Reputation: 85

Okay, solved it!

Here's everything I did to solve the above issue...

Added the following to the top of my routes file:

ini_set( 'display_errors', 1 ); error_reporting( E_ALL );

By adding the above I was able to start getting immediate error responses in the page, this navigated me to storage/logs in that they didn't have the correct permissions set in Ubuntu, so I did the following...

sudo chmod -R 777 storage sudo chmod -R 777 storage/lumen.log

I also found out you needed to have sendmail installed on Ubuntu so that SMTP would be available to use, sent a test mail out and this ended up in my SPAM folder.

Then did a simple PHP mail test, worked, ended up in my SPAM folder.

Ran a third test, changed MAIL_DRIVER=log and sent another email, this ended up on storage/lumen.log

Fourth test, sent email with SES settings, and email went through and arrived in my inbox - yahh!

Upvotes: 1

Related Questions