Sending invoice E-mail

Self-hosted InvoiceNinja v5 with docker
On the setup page, I entered the SMTP of the Gmail mail server and I got Email Server Works!
after that in the invoices section, sending email return timeout error.


docker logs of app container have no such errors.
also, the same result was seen with docker version 5.1.30
I didn’t have this problem with v4

Hi,

Have you seen the info here:

https://invoiceninja.github.io/docs/self-host-troubleshooting/

Part of the .env
MAIL_MAILER=smtp
MAIL_HOST=Server
MAIL_PORT=465
MAIL_USERNAME=Mail username
MAIL_PASSWORD=Pssw
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=Email
MAIL_FROM_NAME=“Name”

thanks for your answer.
with the edited env file, I got the same result

my env file:

APP_URL=https://xxxx.com/
APP_KEY=base64:xxxxxx
APP_DEBUG=false
MULTI_DB_ENABLED=false
DB_HOST1=db
DB_USERNAME1=ninja
DB_PASSWORD1=ninja
DB_DATABASE1=ninja
MAIL_MAILER=smtp
MAIL_HOST=xxxx.com
MAIL_PORT=465
MAIL_USERNAME=‘xxxx.com
MAIL_PASSWORD='complex pass with “” and any special character ’
MAIL_ENCRYPTION=‘ssl’
#this is a system variable please do not remove
IS_DOCKER=true
PHANTOMJS_PDF_GENERATION=false
#V4 env vars
DB_STRICT=false
DB_HOST=db
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=ninja
APP_CIPHER=AES-256-CBC


note that my password has special character and also on the setup page, the field of the database host is not “db” and I must edit that value. in v4 all values were detected by the env file.

Update:
with env file and SMTP of Gmail, email has been sent.
but with SMTP of the public domain with special passwords, error 500 has been ocuuered.

QUEUE_CONNECTION = database

is that mandatory for sending emails?

I’m not sure. I saw it in troubleshooting.

I totally agree. the env file seems pretty useless in v5 as during the setup you have to input all the values defined in the env file anyway…

@ben do you understand the problem here?

@david worked on the Gmail integration. Dave can you help with this?

Are you wrapping the password in double quotes or single quotes?

Depending on the special characters, you may need to use double quotes.

I used single quotes and double quotes, and both have the same result
the result is:

  • when I use the complex password in the env file and try to docker-compose up, the container of the app has no errors, but the setup page couldn’t load and return 500 server error response.
  • when I comment the “MAIL_PASSWORD” in the env file, the setup page successfully loaded but when I write my mail server password in the section of mail server spec (in the web page), after hitting the “Send test email” button, the app container returns this error: Failed to parse dotenv file. Encounter an unexpected escape sequence at [MYPASS]. and the web page redirects to the setup page again

UPDATE:

  • when I use the double quote in the env file, the setup page successfully loaded, but I must to enter the spec of the email server again on page and after hitting the “Send test email” button, the error Failed to parse dotenv file.. occured.

So this is an issue with the special characters, you’ll need to escape them correctly, please see here for more: