DSN
Overview
DSN is a connection string that contains all necessary connection parameters in one expression. In Passwork, the following parameters are used for this:
MAILER_DSN
The configuration string in Passwork that defines how and through which provider to send mail. It specifies the transport type, API key or authorization data, as well as additional parameters.
APP_SENDER_EMAIL
Sets the email address used as the default sender of notifications in Passwork.
Configuration
Edit the Passwork configuration file:
- Linux —
/var/www/init/config.env - Windows Server —
C:\inetpub\wwwroot\passwork\init\config.env - Docker —
/<passwork>/conf/keys/config.env
Basic example of DSN configuration:
- shell
MAILER_DSN=smtp://[email protected]:cdfe%20dynv%20pjxz%[email protected]:465
APP_SENDER_EMAIL=[email protected]
Parameter description
- smtp:// — protocol used for sending emails
- [email protected] — login for connection (username)
- cdfe%20dynv%20pjxz%20odob — password, spaces replaced with %20 (URL encoding)
- smtp.passwork.com — server address through which emails will be sent
- 465 — port used for secure SMTP connections (SSL)
Restart PHP:
- DEB
- RPM
systemctl restart php8.3-fpm.service
systemctl restart php-fpm.service
Clear Passwork temporary cache:
- DEB
- RPM
- Windows Server
sudo -u www-data bash -c 'cd /var/www && php -d memory_limit=-1 ./bin/console cache:clear'
sudo -u apache bash -c 'cd /var/www && php -d memory_limit=-1 ./bin/console cache:clear'
cd "C:\inetpub\wwwroot\passwork"
php -d "memory_limit=-1" .\bin\console cache:clear
DSN string examples
Gmail with SSL (port 465):
- shell
MAILER_DSN=smtp://[email protected]:[email protected]:465
Gmail with TLS (port 587):
- shell
MAILER_DSN=smtp://[email protected]:[email protected]:587?encryption=tls
Mailtrap with TLS:
- shell
MAILER_DSN=smtp://username:[email protected]:2525?encryption=tls
SMTP server without encryption:
- shell
MAILER_DSN=smtp://username:[email protected]:25
SMTP server with TLS encryption on port 587:
- shell
MAILER_DSN=smtp://username:[email protected]:587?encryption=tls
SMTP server with SSL encryption on port 465:
- shell
MAILER_DSN=smtp://username:[email protected]:465