# Step-by-Step Guide to Install and Configure iRedMail on AWS EC2 with SES for Mass Emailing

Publisher: Techno Experts  
Published: 2024-05-25  
Last updated: 2026-03-24  
Page: https://staging.technoexperts.co/step-by-step-guide-to-install-and-configure-iredmail-on-aws-ec2-with-ses-for-mass-emailing

#### Introduction

This guide will walk you through installing and configuring iRedMail on an AWS EC2 instance to handle mass emailing.

It will also guide you on how to set up AWS SES (Simple Email Service) for outgoing emails. This setup ensures a robust and scalable email solution.

#### Prerequisites

1. An AWS account
2. Basic knowledge of Linux commands
3. Domain name for your email server (e.g., `example.com`)
4. Access to the domain's DNS settings

### Step 1: Launch an EC2 Instance

1. **Log in to AWS Management Console.**
2. **Navigate to EC2 Dashboard.**
3. **Launch a new instance:**
    - Choose an Amazon Machine Image (AMI). Preferably, use Ubuntu Server 20.04 LTS.
    - Select an instance type (e.g., t2.micro for testing or t2.medium for production).
    - Configure instance details, storage, and add tags if necessary.
    - Configure security groups:
          - Allow inbound traffic for HTTP (port 80), HTTPS (port 443), SMTP (port 25, 587), IMAP (port 143), and SSH (port 22).
4. **Review and launch the instance.**
5. **Connect to the instance via SSH.**

### Step 2: Update and Prepare Your Server

Update your package lists and install necessary packages:

 `sudo apt update sudo apt upgrade -y sudo apt install wget curl gnupg2 software-properties-common -y`

### Step 3: Install iRedMail

1. **Download iRedMail:**

 `cd /opt wget https://github.com/iredmail/iRedMail/archive/1.5.1.tar.gz tar xvf 1.5.1.tar.gz cd iRedMail-1.5.1`

**Run the iRedMail installer:**

 `sudo bash iRedMail.sh`
1. **Follow the on-screen instructions:**
    - Specify the directory to store mail.
    - Choose a web server (Nginx or Apache).
    - Select the database server (MariaDB, MySQL, or PostgreSQL).
    - Enter the desired password for the mail database.
    - Choose the preferred mail server features.
2. **Finish the installation and note the provided admin credentials.**

### Step 4: Configure DNS for Your Domain

1. **Login to your DNS provider.**
2. **Add the following records:**
    - **A Record:** plaintext

 `mail.example.com. IN A <your_EC2_instance_IP>`

**MX Record:**

 `example.com. IN MX 10 mail.example.com.`

**SPF Record:**

 `example.com. IN TXT "v=spf1 a mx include:amazonses.com ~all"`

**DKIM Record:**  (Generated by iRedMail, add as per iRedMail instructions)

 `default._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=<your_dkim_public_key>"`

**DMARC Record:**

 `_dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com; ruf=mailto:dmarc@example.com; fo=1"`

### Step 5: Configure Postfix to Use AWS SES

1. **Install Postfix SASL dependencies**

 `sudo apt install libsasl2-modules -y`

**Edit Postfix main configuration:**

 `sudo nano /etc/postfix/main.cf`

Add or update the following lines:

 `relayhost = [email-smtp.<region>.amazonaws.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_security_level = may smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt smtp_sasl_mechanism_filter = plain, login`

**Create and edit the SASL password file:**

 `sudo nano /etc/postfix/sasl_passwd`

Add the following line:

 `[email-smtp.<region>.amazonaws.com]:587 SMTP_USERNAME:SMTP_PASSWORD`

Replace `<region>` with your AWS region, and `SMTP_USERNAME` and `SMTP_PASSWORD` with your AWS SES SMTP credentials.

**Secure the password file and apply changes:**

 `sudo postmap /etc/postfix/sasl_passwd sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db sudo chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db sudo systemctl restart postfix`

### Step 6: Configure iRedMail for Mass Emailing

1. **Adjust Amavis configuration for performance (if needed)**

 `sudo nano /etc/amavis/conf.d/50-user`

Increase the number of processes if necessary:

 `$max_servers = 10; # Adjust based on your server capacity`

**Restart Amavis:**

 `sudo systemctl restart amavis`

### Step 7: Test Email Sending

1. **Send a test email using the Roundcube webmail interface provided by iRedMail.**
2. **Monitor logs for any errors**

 `sudo tail -f /var/log/mail.log
sudo tail -f /var/log/mail.err
sudo tail -f /var/log/dovecot.log
sudo tail -f /var/log/nginx/error.log`

### Step 8: Monitor and Maintain

- **Regularly check logs for any issues.**
- **Keep your system and [iRedMail](https://www.iredmail.org/) updated.**
- **Monitor your AWS SES sending limits and reputation.**

*If you have any requirements or need further assistance, please don't hesitate to [**contact us** .](https://staging.technoexperts.co/contact)*

### Conclusion

By following this guide, you have successfully installed and configured iRedMail on an AWS EC2 instance and set up AWS SES for outgoing emails. This setup provides a reliable and scalable email solution suitable for mass emailing while leveraging AWS SES for high deliverability and performance.

