How to add a new domain in iRedMail

I have deployed a mail server using iRedMail. Now I want to add a new domain to this server.

How to add

Configuration on server

1
vim /opt/www/roundcubemail/config/config.inc.php
1
2
3
4
5
6
7
$config['username_domain'] = $config['default_host'] = array(
'127.0.0.1' => 'a.com',
'127.0.0.2' => 'b.com',
'127.0.0.3' => 'c.com',
);
// The ip address can be whatever you like as long as it is in right format.
// 使用的ip如127.0.0.1 或 127.0.0.2, 只要ip格式正确,可以随便写
1
vim /opt/www/roundcubemail/program/include/rcmail.php
1
2
$host = '127.0.0.1';  // add host redirect
//$host = rcube_utils::idn_to_ascii($host); //original code

Add new DNS to your new domain

You need to add a new MX record on DNS server which point to your mail server domain. It is recommended to add a rDNS(PTR record) for your domain, or you cannot send e-mail to gmail.

Add new domain on admin web page.

Log in https://mail.your.domain/iredadmin as admin, and add your new domain to your mail server. Also, do not forget to add a new user for using.

Reference

  1. https://yisangwu.github.io/iredmail/2019/07/21/iredmail-multi-domain.html