Custom Email Domain per Company

How can I have individual SMTP settings per company? At the moment all my companies send using my main companies email domain. I would like this to be on a per company basis.

Hi,

I don’t believe this is currently supported.

Is this something you guys would consider? It makes no sense for company two to have emails coming from company one which is completely unrelated. It also undermines the security of the emails delivered from a trustworthiness perspective

@david is this on the backlog?

I’ve done this for the next release, an important note, this only works if the configuration is NOT cached.

I would assume when the system updates and runs its usual configuration caching that the default mailer will be used until the user runs:

php artisan config:cache
php artisan config:clear

Thats cool! Look forward to testing this.

How does this work in practice, is it configured via UI or in the .env?

@AltF4

It will work the same as V4

You will need to prefix your .env with the primary key of the company ie 1

1_MAIL_HOST=
1_MAIL_PORT=
1_MAIL_USERNAME=null
1_MAIL_PASSWORD=null
1_MAIL_ENCRYPTION=null

And for these configuration, always ensure your cache is never optimized, you’ll want to run:

php artisan config:cache
php artisan config:clear
php artisan config:cache
php artisan config:clear

Sorry I need your help here: How can i run these commands in invoice-ninja running on docker?

What exactly is meant with prefix your .env if I have 2 companies? Does that mean I have
1.env
2.env

or

.1env
.2env
?

Or do I just prefix the smtp settings in the main .env?

Thanks and best,
c–

Got it working by editing the .env …

1 Like