Mailer Configuration¶
Traq needs a way to send emails for notifications. You can configure this using either the Admin Control Panel (recommended) or by editing a configuration file.
Method 1: Admin Control Panel (Recommended)¶
This is the easiest way to set up your mailer.
- Log in as an Administrator.
- Navigate to AdminCP -> Settings.
- Go to the Notifications section.
You will see two fields:
- From Email: The email address you want notifications to come from (e.g.,
[email protected]). - Mailer DSN: A single connection string that tells Traq how to connect to your mail server.
You must build this DSN string yourself.
How to Build Your Mailer DSN¶
The DSN (Data Source Name) string has a specific format:
Important: URL Encoding
If your username or password contains special characters (like !, @, #, ?, /, etc.), you must URL-encode them first. For example, p@ssword! becomes p%40ssword%21.
Common Examples:
-
Standard SMTP Server:
smtp://my-username:[email protected]:587 -
Gmail / Google Workspace: (You must use a 16-character "App Password")
smtp://your-email%40gmail.com:[email protected]:587 -
SendGrid API Key:
smtp://apikey:[email protected]:587
Method 2: Configuration File¶
This method is for advanced users or for setting up automated deployments.
File vs. Admin Settings
Settings in the Admin Control Panel may override the values in this file. It's best to use one method or the other.
-
Open or create the following file on your server:
vendor/traq/config/mailer.php -
Add your configuration using the DSN format.
Example mailer.php:
<?php
return [
'dsn' => sprintf(
'smtp://%s:%s@%s',
urlencode('my-username'),
urlencode('my-password'),
'smtp.my-site.com:587',
)
];