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.

This is the easiest way to set up your mailer.

  1. Log in as an Administrator.
  2. Navigate to AdminCP -> Settings.
  3. 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:


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.

  1. Open or create the following file on your server: vendor/traq/config/mailer.php

  2. 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',
    )
];