Emails not sending through

Self-hosted, shared hosting, php 8.1

Attempted automatic upgrade from v5.4.11 to v5.5.48 broke IN. I installed and manually migrated my data via JSON export. I also updated the .env file in my new install with the exact same settings from my original 5.4 install. However, I cannot send emails as per the screenshot below:

image

Logs do not show this error at all. Where do I begin troubleshooting this?

Here is the .env

APP_NAME=“Invoice Ninja”
APP_ENV=production
APP_KEY=[key]
APP_DEBUG=“false”

APP_URL=“https://mydomain.com/public

DB_CONNECTION=“mysql”
MULTI_DB_ENABLED=false

DB_HOST=“127.0.0.1”
DB_DATABASE=“database”
DB_USERNAME=“database_user”
DB_PASSWORD=“database_pw”
DB_PORT=“3306”

DEMO_MODE=false

BROADCAST_DRIVER=log
LOG_CHANNEL=stack
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=[host]
MAIL_PORT=465
MAIL_USERNAME=[my email]
MAIL_PASSWORD=“[password]”
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=‘[My email]’
MAIL_FROM_NAME=‘scribble3392’

POSTMARK_API_TOKEN=
REQUIRE_HTTPS=“true”

GOOGLE_MAPS_API_KEY=
ERROR_EMAIL=
TRUSTED_PROXIES=

NINJA_ENVIRONMENT=“selfhost”

#options - snappdf / phantom / hosted_ninja
PDF_GENERATOR=hosted_ninja

PHANTOMJS_KEY=[key]
PHANTOMJS_SECRET=secret

UPDATE_SECRET=secret

DELETE_PDF_DAYS=60
DELETE_BACKUP_DAYS=60

COMPOSER_AUTH=‘{“github-oauth”: {“github.com”: “${{ secrets.GITHUB_TOKEN }}”}}’
SENTRY_LARAVEL_DSN=[url here]

GOOGLE_PLAY_PACKAGE_NAME=
APPSTORE_PASSWORD=

MICROSOFT_CLIENT_ID=
MICROSOFT_CLIENT_SECRET=
MICROSOFT_REDIRECT_URI=

APPLE_CLIENT_ID=
APPLE_CLIENT_SECRET=
APPLE_REDIRECT_URI=

Hi,

It may help to run php artisan optimize

@david do you have any suggestions?

I am on shared hosting so I don’t know how to run commands unfortunately. I have cleared web cache etc., if that helps.

In that case you can try loading /public/update?secret= in your browser

No dice, same error.

I have created a new company and attempted to send invoices to 2 alternate addresses. The new company threw up the same error about the From or Sender header. I presume from this there is a fundamental error in my config somewhere, has there been an update on how the .env should be configured perhaps?

EDIT: The original v5.4 install is still successfully sending emails.

Can you confirm the from name and email are set in the .env

Confirmed! On my .env:

FYI this is still an issue.

Is there any way I can access backup without email (so directly on the server)? I want to see if restoring my 5.5.48 company instance to 5.4.11 makes any difference.

The backup should be located in public/storage/backups

it will live there for an hour before being wiped by the system.

Thanks David. So what I have done

Request export JSON backup from v5.5
Download .zip from public/storage/backups
Import to v5.4
Refresh (at this point the company logo of both original company and newly imported company disappear from dashboard)
Load /public/update?secret= in my browser

The newly imported company does not have any clients, invoices, vendors, projects etc. Is there any way to check when the import has been successfully completed? At this point it has been at least 30min but perhaps it takes even longer?

@scribble3392

Two possible things are happening here:

  1. The Import isn’t starting
  2. The import is starting and hits a failure.

Can you advise the QUEUE_CONNECTION that you have configured in the .env file?

if it is database, then you need to ensure the queues are running. If you have command link access you can try running

php artisan queue:work

If QUEUE_CONNECTION=sync

then the import should start immediately, you can find more information in storage/logs/laravel.log or storage/logs/invoiceninja.log

Thanks David.

The import seems to have failed with the following in laravel.log

[2023-01-03 01:39:24] production.INFO: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘bank_category_id’ in ‘field list’ (SQL: insert into expense_categories (name, company_id, created_at, updated_at, deleted_at, is_deleted, color, bank_category_id, user_id) values (Accounting & Admin, 5, 2022-12-28 10:17:08.000000, 2022-12-28 10:17:08.000000, ?, 0, , ?, 2))

OK - ignore the sidequest into successful backups.

I received the “Your company backup is ready for download” email from v5.5 (in spam, hence the belatedness). Presumably that means there’s nothing wrong with my .env config, IN5.5 just does not like sending invoices. Where else could I troubleshoot “From” or a “Sender header” errors?

@scribble3392

From the error message it looks like you have migrations that are yet to run, can you please try running

php artisan migrate

In regards to emails, if you received the backup email, it means the system is correctly configured. There may be another issue perhaps? Are there any errors in the logs?

v5.5 logs are completely empty. I have tried a search of the term “header” and “From” in the filesystem but that does not really get me anywhere either.

php artisan migrate tells me nothing to migrate

Refreshed, no difference.