Skip to main content

Email Testing

This guide explains how to test email functionality in Plugged.in using Mailtrap for development and staging environments.

Quick Setup with Mailtrap

1

Create Mailtrap Account

Sign up for a free account at Mailtrap.io
2

Get SMTP Credentials

Navigate to Inboxes → Select inbox → SMTP Settings → Choose Nodemailer
3

Configure Environment

4

Test Email Delivery

Email Templates

Plugged.in includes responsive HTML email templates for various notifications:

Verification Email

Sent when users register to verify their email address

Password Reset

Sent when users request a password reset

Notifications

Activity alerts and system notifications

Welcome Email

Onboarding email for new users

Development Setup

1. Install Dependencies

Ensure email dependencies are installed:

2. Configure Mailtrap

  1. Log into Mailtrap Dashboard
  2. Navigate to Inboxes
  3. Click on your inbox
  4. Copy SMTP credentials
  5. Select Nodemailer integration

3. Environment Configuration

Create or update .env.local:

4. Test Email Functionality

Using Application Forms

  • Password Reset: Visit /forgot-password
  • User Registration: Visit /register
  • Email Verification: Complete registration flow

Using Test Endpoint

Email Template Customization

Template Structure

All email templates follow this structure:

Customizing Templates

Edit email templates in lib/email.ts:

Logo Customization

Logos are embedded as base64 to ensure display even when images are blocked.
Replace the logo:
Logo Guidelines:
  • Maximum size: 30KB (to avoid email size issues)
  • Recommended dimensions: 200x50px
  • Format: PNG with transparency or JPEG
  • Optimize before converting to base64

Testing Strategies

Unit Testing

Integration Testing

Production Email Services

Supported Providers

Production Checklist

Email Debugging

Common Issues

Solutions:
  • Verify Mailtrap credentials in .env
  • Check console for error messages
  • Ensure EMAIL_SERVER_PORT is 2525 (not 25 or 587)
  • Test connection with telnet: telnet sandbox.smtp.mailtrap.io 2525
Solutions:
  • Check firewall settings
  • Verify network allows outbound SMTP
  • Try alternative ports (2525, 587, 465)
  • Use secure connection: EMAIL_SERVER_SECURE=true
Solutions:
  • Regenerate Mailtrap credentials
  • Ensure no extra spaces in credentials
  • Check for special characters that need escaping
  • Verify account is active and not suspended
Solutions:
  • Use base64 embedded images
  • Keep image size under 30KB
  • Test in multiple email clients
  • Provide alt text for accessibility

Debug Mode

Enable detailed logging:

Testing Tools

Mailtrap

Safe email testing sandbox mailtrap.io

Mail Tester

Spam score analysis mail-tester.com

Litmus

Email client preview testing litmus.com

Email on Acid

Comprehensive email testing emailonacid.com

API Reference

Test Email Endpoint

Email Service Methods

Support

For email testing assistance: