Google workspace SMTP in docker environment

In testing I have some odd periods where emails will stop sending for a couple hours or until the next day. I can not find any errors on my google workspace side that says the emails are being seen as spam or otherwise when this occurs. Sometimes it is fine, last night for example I was able to do a live test with our clients sending some invoices and paid notices and all worked fine. I just have to now watch very carefully that emails are actually sending out.

I have read on some specific tweaks/settings for this scenario and I have question about this line that I think I should add to see if helps these periodic fails: MAIL_EHLO_DOMAIN=“

Being that I am working with a docker environment that is entirely self contained and local there is not TLD or domain assigned or pointed at this instance. I am not clear what is “acceptable” to use as the entry ? I access my instance via a local IP with no internet facing access so it would not resolve to any official domain name.


@david do you have any suggestions?

Well between last night and today I’ve read and studied more on EHLO than I ever want to again LOL…and I’m still not entirely sure what is acceptable usage. I’ve many comments that says you can use the literal IP address within [ ] but in my case I am still not sure what I can/should use. The IP of the docker container, the IP of the actual host PC, the IP of my router, or the non-static IP of my modem.

As something to try I did enable 2FA on my google workspace domain and go through the process of turning that on for the account being used here and then creating an APP password. I have tested sending an invoice and it is currently working. My hope is that gmail SMTP relay may recognize and be less apt to prevent the relay but I’m not really sure how google “decides” what it lets through. Will continue from here. If anyone has suggestions on setting this I’m still open to hearing what works for you in this scenario.

I suppose the other easier thing to do is to use some other mail service. I really won’t be sending too many emails per month once we go live with IN this next month.


Just chronicling my issue here… Just went to send our first “real” invoice and it did not go through. One single invoice and in the web interface logs, google is still complaining about ehlo. I had really hoped changing to app password would get around this and it did work for several tests the other day. Don’t understand how google decides what to allow or not. Still looking for advice on what I could enter for that EHLO domain with no actual resolvable domain pointing back at my instance.

Can you switch to React app and go to settings => system logs, it should show the logs for failed events.
Unfortunately no exact email / client reference there.
I think you are actually getting the 421 reply from google SMPT - same as I do, seems like something is not handling the email queue on the invoice ninja side correctly. 421 response in oure case should mean too many connections.
See example below with my fails:

root:"Expected response code "250" but got code "421", with message "421-4.7.0 Try again later, closing connection. (EHLO) 421-4.7.0 For more information, go to 421 4.7.0 l19-20020a056638145300b0046edaf89690sm58018jad.46 - gsmtp"."

I’ve set my Google SMTP using - How to send email from your Google Workplace hosted email account

I also can send 1000 emails in a raw using google scripts and google spreadsheet, but can’t send single email with invoice ninja :slight_smile:

Reason I think something happened on invoice ninja side recently.

1 Like

I’m not at a computer at the moment but pretty sure that is the exact error I see in my log. I’m on a fairly new install using the default interface but I can double check soon.

It’s odd as I mentioned sometimes they go through other times not. I assumed it was something Google smtp wasn’t liking as thus far I can try sending later and it will work. I need to try resending that invoice tonight so I’ll be looking at it again before the night is over.

Google smpt not liking the way invoice ninja is trying to establish connection.
I have WordPress instance using same Google credentials with 0 issues, sending emails everyday.

1 Like

…And like other times, I think this time the invoice emailed out like it should. I usually see the failed message within 5-10 minutes. It’s been about 30 minutes now so I’m assuming it went through. Would be really nice if IN had a built in setting you could turn on to have emails “retry” when the fail every so many minutes or something.

Github issue created… Leave your comments there to support :slight_smile:

1 Like