In email sending, reliability, deliverability, and IP reputation are very important. Especially in VPS-based servers (see: VPS Server), using an external SMTP provider like Mail.Baby in popular control panels such as cPanel/WHM offers effective solutions to these problems. This article explains step by step how to connect the Mail.Baby SMTP service via WHM and details how to maximize email delivery with optimized settings.
What is Mail.Baby?
Mail.Baby is a transactional email SMTP service with low latency and a high success rate. It offers easy integration with Exim on WHM servers. It also provides a great advantage to the user in terms of SPF, DKIM, and IP reputation.
1. Requirements and Preparation
-
An active VPS server
-
cPanel/WHM version 106 or 108+
-
Mail.Baby account and SMTP information (server, port, username, password)
-
root SSH access
2. Basic Settings Required for Mail.Baby in WHM
WHM >> Service Configuration >> Exim Configuration Manager >> Basic Mode:
-
Use the reverse DNS entry for the mail HELO/EHLO if available: OFF
-
SPF include hosts for all domains on this system: spf-c.mailbaby.net
-
Enable Sender Rewriting Scheme (SRS) Support: ON
In addition, the following security scans should also be enabled:
-
Scan messages for malware from authenticated senders
-
Scan outgoing messages for malware
-
Scan outgoing messages for spam and reject based on SpamAssassin score
-
Do not forward mail to external recipients based on SpamAssassin score
Also, the mail sending limit should be determined via WHM >> Tweak Settings (e.g., 300/hour).
3. Exim Advanced Configuration (Advanced Mode)
WHM >> Exim Configuration Manager >> Advanced Editor
AUTH:
mailbaby_login:
driver = plaintext
public_name = LOGIN
client_send = : YOURUSERNAME : YOURPASSWORD
POSTMAILCOUNT (for v108+):
remoteserver_route:
driver = manualroute
.ifdef SRSENABLED
transport = ${if eq {$local_part@$domain} \
{$original_local_part@$original_domain} \
{mailbaby_smtp} {mailbaby_forward_smtp}}
.else
transport = mailbaby_smtp
.endif
domains = !+local_domains
ignore_target_hosts = 127.0.0.0/8
route_list = * relay.mailbaby.net::25 randomize byname
host_find_failed = defer
no_more
TRANSPORTSTART:
mailbaby_smtp:
driver = smtp
hosts_require_auth = *
tls_tempfail_tryclear = true
headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*} \
{$authenticated_id} {${if match {$authenticated_id}{.+} \
{$authenticated_id@$primary_hostname}{$authenticated_id}}}}
dkim_domain = ${lookup{$sender_address_domain}lsearch,ret=key{/etc/localdomains}}
dkim_selector = default
dkim_canon = relaxed
dkim_private_key = "/var/cpanel/domain_keys/private/${dkim_domain}"
mailbaby_forward_smtp:
driver = smtp
hosts_require_auth = *
tls_tempfail_tryclear = true
headers_add = X-AuthUser: ${if match {$authenticated_id}{.*@.*} \
{$authenticated_id} {${if match {$authenticated_id}{.+} \
{$authenticated_id@$primary_hostname}{$authenticated_id}}}}
dkim_domain = ${lookup{$sender_address_domain}lsearch,ret=key{/etc/localdomains}}
dkim_selector = default
dkim_canon = relaxed
dkim_private_key = "/var/cpanel/domain_keys/private/${dkim_domain}"
.ifdef SRSENABLED
return_path = ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}
.endif
max_rcpt = 1
RETRYSTART:
* data_4xx F,4h,1m
* rcpt_4xx F,4h,1m
* timeout F,4h,1m
* refused F,1h,5m
* lost_connection F,1h,1m
* * F,6h,5m
RETRYBLOCK:
+secondarymx * F,4h,5m; G,16h,1h,1.5; F,4d,8h
* * F,2h,15m; G,16h,1h,1.5; F,4d,8h
* auth_failed
4. Greylisting IP Definitions (via CLI)
To add Mail.Baby IP ranges to the trusted list, run the following commands via SSH:
whmapi1 create_cpgreylist_trusted_host ip='162.220.160.0/28' comment='MailBaby'
whmapi1 create_cpgreylist_trusted_host ip='68.168.211.160/28' comment='MailBaby'
... (full list provided above)
5. Test and Validation
-
Send a test email via WHM Mail Queue Manager
-
Verify routing with the command
exim -bt [email protected]
-
Check spam score via mail-tester.com
6. Advanced Configurations (Optional)
A) Sending with mailbaby only to specific domains:
domains = lsearch:/etc/exim_domains_include
Write the domain names to the /etc/exim_domains_include
file.
B) Excluding specific domains:
senders = : [email protected] : !*@domain2.com
C) Forwarding emails only from specific domains:
senders = *@domain1.com : [email protected]
In these configurations, the above combinations can be used in the POSTMAILCOUNT
section.
Conclusion
Mail.Baby integration on cPanel/WHM is ideal for reducing spam risks, increasing deliverability, and preventing blacklisting. The steps described above should be carefully implemented by system administrators.
For WHM Mail.Baby installation and much more, you can check out our Server Setup and Optimization Services page.