Self Hosted - Emails Not working after first (sendgrid)

Hello,

I just discovered Invoice Ninja, and figured I would try it out. I was able to set up and import my clients/invoices, integrate with a payment processor (still testing there), get crons working but now I am trying to get emails to work.

Since my volume is really low, I decided to try Sendgrid to simplify the process since they give 100 free emails per month.

I created an API key, added the proper info, and on my first test, an email went through and shows up on the Sendgrid side as well. This was all done in the .env file. I moved along for a bit setting up other things, like customizing invoices, but then wanted to test again.

On my second test - no email. Same with any of the following tests. Sendgrid doesn’t see it as being sent.

I don’t see any errors logs in storage/logs, and there is nothing in the System Logs tab in the Dashboard of Invoice Ninja.

I also am not 100% sure if the queue is needed for email to work properly or not. I enabled it by changing it to database, but then tried testing again with it set to sync. In both cases, no emails were sent out (but a popup did say “this is being added to the queue”)

(Sidenote: I also don’t know how to view the queue, in case all of a sudden my tests will all send at once. Assume this is something on the server side I’d have to see, but I wasn’t sure if there was something in the dashboard too).

The only other important factor is that my host limits CRONS to every 15 minutes, so I have my cron set to 0,20,40 - I don’t know if this makes a difference or is a problem overall, but I’ve waited over an hour just in case it has something to do with the queue, but I’m still at only one successful email sent through Sendgrid despite a few attempts. Any advice would be appreciated.

My Health Check shows all green checkmarks except SnapPDF not enabled.

v5.7.5-C123

(Also of note, I’ve looked through a lot of support stuff here, a lot of people link to github articles that don’t exist anymore. I assume the contents might be the same stuff found at this guide but not 100% sure).

Hi,

In the health check is the queue set to database or sync? The queue:work cron is required if the queue is set to database.

I set it to database as per another thread here and added this cron:

0,20,40 * * * * cd && php -d register_argc_argv=On artisan queue:work --stop-when-empty

That said, I just checked back an hour after my post, and I at least now see some errors in the Systems Log tab

Email > Failure
Email Send * Client
Aug 30, 2023 5:20:04PM

and a few others. But I don’t see any thing here that helps me troubleshoot things now that I am at least seeing errors inside invoice ninja.

Still nothing in the directory storage/logs though

(I also don’t even know if I need a queue. I can disable this if it is somehow the culpret. I have a small amount of clients with only a couple of automated invoice that go out once 3 months). I assume I want this feature, but I still don’t know how to check what is in the queue (maybe this is a Laravel feature, I am not that familiar with Laravel although I suppose I should start learning more).

If it helps, these are the settings I have in the .EML file (which again, is weird since it worked one time then stopped)

MAIL_MAILER=“smtp”
MAIL_HOST=“smtp.sendgrid.net
MAIL_PORT=“465”
MAIL_USERNAME=“************"
MAIL_PASSWORD=“********************************”
MAIL_ENCRYPTION=“ssl”
MAIL_FROM_ADDRESS="do-not-reply@
.com”
MAIL_FROM_NAME=“********”

I suggest testing without the queue by setting it to sync to see if it helps.

I tested it with sync, health check says queue is disabled, but still no emails after that first one. I waited a full 40 minutes just in case since my crons are every 20 minutes.

I’ve double checked the smtp settings a few time and it all looks correct.

There is no entries in the system log using this setting. (I am getting other entries for instance, successes for payments, etc, but nothing for email)

Hmm… if it worked initially I’m not sure why it would stop working. Can you think of anything else which may have changed.

Another option may be to test with a different email provider.

@david may have some other suggestions.

Yes, not sure. I’m new to the platform and it’s been mostly seamless minus a few things to relearn/learn. I haven’t made any other customizations other than stuff inside the admin, like invoice customizations importing invoices/clients.

I would assume that if I did misconfigure… the failed emails would keep showing consistently in the System Logs one way or the other OR that there wouldn’t be any successful emails through Sendgrid.

But they don’t and the ones that are there don’t give any info.

Hopefully it’s something simple.

If you’re seeing a system log error without any details I think that can be considered a bug. You may want to create an issue on the main GitHub repo.

If it’s possible to confirm, there should be a code or error written here I assume?

missing-data_clean

Either way, I can’t get a log to show up any more at all when I send emails. I guess I can try github although not sure what to technically report.

If there is an error in the system logs the details should be included, if they aren’t there it seems like a bug.

Yeah nothing shows up, I am not even getting an “Email > Failure” in the log anymore after that first day.

Since you seem the most active - is the best place to get help on these forums or should I be posting a thread on the github? I haven’t posted on github yet because I don’t know specifically if I can call it bug when I am not 100% sure what is wrong.

Everything else seems to be working fine beyond this email feature. There arent’ any other free SMTP and I do not want to use my servers email for some other reasons, but maybe I’ll have to.

Thanks for any advice.

I don’t think this belongs on GitHub, it seems more likely it’s a configuration issue.

If you haven’t already I suggest checking storage/logs for any errors.

Testing with a different email provider seems like a good next step.