Environment Setup

Environment File Overview

MailTrixy uses a .env file for all configuration. If you used the Web Installer, this file was created automatically — you don't need to edit it manually.

Most users don't need this page. The Web Installer handles everything. This page is only for users who want to change settings later or set up optional features like AI, WhatsApp, or cloud storage.

Application Settings

APP_NAME="MailTrixy"
APP_ENV=production
APP_KEY=base64:generated-key-here
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=https://yourdomain.com

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
Variable Description
APP_NAMEApplication name displayed in emails and the UI
APP_ENVEnvironment mode: production, local, or staging
APP_KEYEncryption key (auto-generated by installer or php artisan key:generate)
APP_DEBUGSet to false in production. Shows detailed errors when true
APP_TIMEZONEServer timezone (e.g., UTC, America/New_York, Asia/Kolkata)
APP_URLFull URL of your installation (used for generating links in emails)

Database Configuration

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mailtrixy_db
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password

MailTrixy supports MySQL 5.7+ and MariaDB 10.3+. The database must use the utf8mb4 character set for proper emoji and multi-language support.

Shared Hosting: On some shared hosts, the database host may be different from 127.0.0.1. Check your hosting panel for the correct MySQL hostname (e.g., mysql.hostinger.com).

Mail / SMTP Configuration

This configures how MailTrixy sends system emails (password resets, verification emails, subscription notifications). This is separate from the email accounts users connect for their inbox.

MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your@email.com
MAIL_PASSWORD=your_smtp_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"

Common SMTP providers:

Provider Host Port Encryption
Gmailsmtp.gmail.com587TLS
Outlook / Office 365smtp.office365.com587TLS
Amazon SESemail-smtp.us-east-1.amazonaws.com587TLS
Mailgunsmtp.mailgun.org587TLS
SendGridsmtp.sendgrid.net587TLS

SMTP can also be configured via the Admin Panel: Admin → System Settings → SMTP.

OAuth Configuration (Gmail, Outlook, GitHub)

OAuth is used for two purposes: (1) social login for users, and (2) connecting Gmail/Outlook accounts to the inbox via OAuth instead of app passwords.

Gmail OAuth

# Gmail OAuth (for inbox connection & social login)
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REDIRECT_URI=${APP_URL}/auth/google/callback

To obtain credentials:

  1. Go to Google Cloud Console
  2. Create a project (or select existing)
  3. Enable the Gmail API and Google+ API
  4. Go to Credentials → Create Credentials → OAuth 2.0 Client ID
  5. Set the authorized redirect URI to: https://yourdomain.com/auth/google/callback

Outlook / Microsoft OAuth

# Microsoft OAuth (for inbox connection & social login)
MICROSOFT_CLIENT_ID=your_microsoft_client_id
MICROSOFT_CLIENT_SECRET=your_microsoft_client_secret
MICROSOFT_REDIRECT_URI=${APP_URL}/auth/microsoft/callback

To obtain credentials:

  1. Go to Azure Portal → Azure Active Directory → App Registrations
  2. Register a new application
  3. Set the redirect URI to: https://yourdomain.com/auth/microsoft/callback
  4. Under Certificates & Secrets, create a new client secret
  5. Under API Permissions, add: Mail.Read, Mail.Send, User.Read, offline_access

GitHub OAuth

# GitHub OAuth (social login only)
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_REDIRECT_URI=${APP_URL}/auth/github/callback

Go to GitHub Developer Settings → OAuth Apps → New OAuth App. Set the callback URL to: https://yourdomain.com/auth/github/callback.

AI Provider Configuration

MailTrixy supports four AI providers for generating email replies, summaries, and knowledge base answers. You can enable one or multiple providers simultaneously.

# OpenAI (GPT-4o, GPT-4, GPT-3.5-turbo)
OPENAI_API_KEY=sk-your-openai-key
OPENAI_MODEL=gpt-4o

# Anthropic (Claude 3.5 Sonnet, Claude 3 Haiku)
ANTHROPIC_API_KEY=sk-ant-your-anthropic-key
ANTHROPIC_MODEL=claude-3-5-sonnet-20241022

# Google Gemini (Gemini 1.5 Pro, Gemini 1.5 Flash)
GEMINI_API_KEY=your-gemini-api-key
GEMINI_MODEL=gemini-1.5-pro

# Mistral (Mistral Large, Mistral Medium, Mistral Small)
MISTRAL_API_KEY=your-mistral-api-key
MISTRAL_MODEL=mistral-large-latest
Provider Get API Key Best For
OpenAIplatform.openai.comGeneral-purpose replies, high accuracy
Anthropicconsole.anthropic.comLong-form responses, nuanced tone
Google Geminiaistudio.google.comCost-effective, fast responses
Mistralconsole.mistral.aiEuropean data residency, multilingual

AI providers can also be configured via the Admin Panel: Admin → AI Configuration.

Stripe Payment Configuration

# Stripe
STRIPE_KEY=pk_live_your_publishable_key
STRIPE_SECRET=sk_live_your_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret

To set up Stripe:

  1. Go to Stripe Dashboard
  2. Get your API keys from Developers → API Keys
  3. Create a webhook endpoint at https://yourdomain.com/webhooks/stripe
  4. Select events: checkout.session.completed, customer.subscription.updated, customer.subscription.deleted, invoice.payment_succeeded, invoice.payment_failed
Note: Stripe is one of 40+ supported payment gateways. Other gateways (PayPal, Razorpay, Mollie, etc.) are configured through the Admin Panel: Admin → Payment Gateways.

Channel Configuration

WhatsApp (Meta Cloud API)

# WhatsApp Business API
WHATSAPP_TOKEN=your_whatsapp_access_token
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id
WHATSAPP_BUSINESS_ACCOUNT_ID=your_business_account_id
WHATSAPP_VERIFY_TOKEN=your_custom_verify_token
WHATSAPP_WEBHOOK_URL=${APP_URL}/webhooks/whatsapp

SMS (Twilio)

# Twilio SMS
TWILIO_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_FROM_NUMBER=+1234567890

Telegram

# Telegram Bot
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_WEBHOOK_URL=${APP_URL}/webhooks/telegram

Create a bot via @BotFather on Telegram and use the provided token.

Slack

# Slack Integration
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your_signing_secret
SLACK_APP_ID=your_app_id

Create a Slack app at api.slack.com/apps. Required scopes: chat:write, channels:history, im:history, users:read.

Storage Configuration

# Default: local filesystem
FILESYSTEM_DISK=local

# Amazon S3 (or S3-compatible: DigitalOcean Spaces, MinIO, Wasabi)
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your_bucket_name
AWS_URL=https://your-bucket.s3.amazonaws.com
AWS_USE_PATH_STYLE_ENDPOINT=false

To use S3 storage, change FILESYSTEM_DISK=s3. For S3-compatible providers like DigitalOcean Spaces or Wasabi, set the AWS_ENDPOINT variable:

# DigitalOcean Spaces
AWS_ENDPOINT=https://nyc3.digitaloceanspaces.com

# Wasabi
AWS_ENDPOINT=https://s3.wasabisys.com

Storage settings can also be managed via: Admin → System Settings → Storage.

Queue Configuration

QUEUE_CONNECTION=database

The default database driver works out of the box on all hosting environments. For higher performance on VPS, you can switch to Redis:

QUEUE_CONNECTION=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

See the Queue & Cron Setup page for detailed configuration of queue workers and scheduled tasks.

Broadcasting (Real-time)

# Pusher (recommended for shared hosting)
BROADCAST_CONNECTION=pusher
PUSHER_APP_ID=your_app_id
PUSHER_APP_KEY=your_app_key
PUSHER_APP_SECRET=your_app_secret
PUSHER_APP_CLUSTER=mt1

# OR Laravel Reverb (self-hosted, for VPS)
BROADCAST_CONNECTION=reverb
REVERB_APP_ID=your_app_id
REVERB_APP_KEY=your_app_key
REVERB_APP_SECRET=your_app_secret
REVERB_HOST=0.0.0.0
REVERB_PORT=8080

Broadcasting is used for real-time inbox updates, live chat notifications, and workflow execution feedback. It is optional — the application works without it, but the UI will not update in real time.

Complete .env Reference

Below is a complete .env file with all available variables and their default values:

APP_NAME="MailTrixy"
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=https://yourdomain.com
APP_LOCALE=en
APP_FALLBACK_LOCALE=en

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mailtrixy_db
DB_USERNAME=root
DB_PASSWORD=

MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"

QUEUE_CONNECTION=database
CACHE_STORE=database
SESSION_DRIVER=database

FILESYSTEM_DISK=local

BROADCAST_CONNECTION=log

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI=${APP_URL}/auth/google/callback

MICROSOFT_CLIENT_ID=
MICROSOFT_CLIENT_SECRET=
MICROSOFT_REDIRECT_URI=${APP_URL}/auth/microsoft/callback

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URI=${APP_URL}/auth/github/callback

OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o
ANTHROPIC_API_KEY=
ANTHROPIC_MODEL=claude-3-5-sonnet-20241022
GEMINI_API_KEY=
GEMINI_MODEL=gemini-1.5-pro
MISTRAL_API_KEY=
MISTRAL_MODEL=mistral-large-latest

STRIPE_KEY=
STRIPE_SECRET=
STRIPE_WEBHOOK_SECRET=

WHATSAPP_TOKEN=
WHATSAPP_PHONE_NUMBER_ID=
WHATSAPP_BUSINESS_ACCOUNT_ID=
WHATSAPP_VERIFY_TOKEN=
WHATSAPP_WEBHOOK_URL=${APP_URL}/webhooks/whatsapp

TWILIO_SID=
TWILIO_AUTH_TOKEN=
TWILIO_FROM_NUMBER=

TELEGRAM_BOT_TOKEN=
TELEGRAM_WEBHOOK_URL=${APP_URL}/webhooks/telegram

SLACK_BOT_TOKEN=
SLACK_SIGNING_SECRET=
SLACK_APP_ID=

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
Last updated 25/03/2026