πŸ“§Mailgun

Mailgun Setup Tutorial

Fast Phoenix includes Mailgun integration for sending transactional emails and running email campaigns. Follow these steps to configure Mailgun for your project.


Step 1: Prepare Your Environment Variables

Fast Phoenix uses environment variables to manage Mailgun configuration. You will also have to set this in your config.ex file under config :mailgun.. As the module requires the variables at compile time. Open your .env file and ensure the following variables are set:

# Mailgun Configuration
MAILGUN_API_KEY=your_mailgun_api_key
MAILGUN_DOMAIN=https://api.mailgun.net/v3/your-domain.com

Replace the placeholder values with your actual Mailgun API key and domain.


Step 2: Set Up Mailgun Account

  1. Create a Mailgun Account Sign up or log in to your Mailgun Dashboard.

  2. Add Your Domain

    • Navigate to Domains and add your sending domain (e.g., your-domain.com).

    • Follow the DNS setup instructions provided by Mailgun to verify your domain.

  3. Get Your API Key

    • Once your domain is verified, go to API Keys in your account settings.

    • Copy your private API key and paste it into the MAILGUN_API_KEY field in your .env file.


Step 3: Test Mailgun Integration

  1. Send a Test Email In your Phoenix application, you can send a test email to verify the setup:

  2. Verify the Email Check the recipient's inbox or your Mailgun logs to confirm the email was sent successfully.


Step 4: Configure Email Templates

Fast Phoenix supports customizable email templates stored in the database. You can manage them directly from the admin interface:

  1. Navigate to the admin dashboard.

  2. Select Email Templates to view, create, or edit templates.


Step 5: Bulk Email Campaigns

Use Fast Phoenix emailing capabilities to send bulk emails directly from the admin dashboard:

  1. Set filters for user types to target specific audiences.

  2. Compose your email campaign using a custom template.

  3. Launch the campaign, and track its performance in the Mailgun Dashboard.

Last updated