Mail Configuration
Mail Settings
These are the configuration settings for your mail server:
- Host: The hostname of your SMTP server. Defaults to 'smtp.mailtrap.io' if not specified in the environment.
- Port: The port number of your SMTP server. Defaults to 2525 if not specified in the environment.
- Secure: Indicates whether the connection should use SSL/TLS. Defaults to false.
- Authentication: The authentication credentials for your SMTP server.
- Username: The username for authentication. Defaults to 'user' if not specified in the environment.
- Password: The password for authentication. Defaults to 'password' if not specified in the environment.
- From: The default sender email address. Defaults to 'admin@location.dev' if not specified in the environment.
Importing Environment Variables
Ensure that you import environment variables from env.mjs
to configure your mail settings dynamically.
If you have connfigured the environment variable correctly you will not have to worry about this code.
src/config/mail.ts
export const MAIL = {
host: env.SMTP_HOST || 'smtp.mailtrap.io',
port: parseInt(env.SMTP_PORT || '2525'),
secure: false,
auth: {
user: env.SMTP_USER || 'user',
pass: env.SMTP_PASSWORD || 'password',
},
from: env.SMTP_FROM_EMAIL || 'admin@location.dev',
};