Setting up email on a self-hosted installation (V 5.1.42)


I’ve installed InvoiceNinja through Softaculous and did the front-end setup. When I tried to email an invoice, the message at the bottom of the screen said “Successfully emailed invoice” (which it did after every unsuccessful event) but the client didn’t get it.

I started searching online and found out that I need to update the .env file.

Here is what I put there:

I tried without apostrophes as well.

Then I found out I had to run “php artisan optimize” though terminal, which I did in the /ninja directory and got:
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Files cached successfully!

Then I tried to sent the invoice to a TEST CLIENT that I created with one of my own email addresses.
There is nothing at all with today’s date in the storage/logs/laravel.log (it’s the only file in this folder apart from .gitignore.

I check under Dashboard->System logs and Dashboard->Activity and saw the following messages:
Email > Failure
Email Send * TEST CLIENT
25-April-2021 4:04:42 PM

I tried to search for 'Address in mailbox given [] does not comply with RFC 2822" and gathered from what I found that [] was supposed to contain my MAIL_USERNAME from .env. But it is there, it’s not empty.

I wonder what else still needs to be done to enable sending invoices by email.
And why does it say under Activity that I emailed the invoice to myself rather than my TEST CLIENT?


I think you may also need to fill in these fields and then rerun the optimize command


Hi @hillel,

Thank you for your suggestion. I have tried that and unfortunately the result is the same. Besides, doesn’t Ninja have Reply-To Name and Reply-To Email in its front-end email settings?

I am also puzzled as to why there are no entries in the log file relating to my attempts to email the invoice? I mean there are some, but they are entered at a completely different time (maybe because of the cron schedule?) They look like this:

[2021-04-25 01:14:14] production.INFO:
[2021-04-25 01:14:50] production.INFO: