3.8 KiB
hMailServer Configuration Project
Overview
Project to document and track hMailServer SMTP relay configuration issues and resolution.
Background
Problem
John's hMailServer was configured to use Mailjet as an SMTP relay for outbound email. However, Mailjet disabled the account because they detected emails being sent from "suspicious/banned" addresses.
Initial Discovery
When investigating, John found that the flagged emails were all addresses that had sent spam TO his server (john@assettrackr.co), not emails he was sending out. This was confusing because:
- Emails addressed TO his domain should be received locally, not sent back out through the relay
- Mailjet shouldn't have seen these messages if they were inbound only
Root Cause
The issue was that hMailServer was not configured with proper SMTP routes to distinguish between:
- Local traffic - emails destined for domains hosted on this server (should be delivered locally)
- Remote traffic - emails for external domains (should be relayed through Mailjet)
Without this routing configuration, all outbound SMTP traffic was being sent through the relay, including what should have been local deliveries.
Configuration Details
hMailServer SMTP Relay Settings (Before Fix)
Relay server: smtp-relay.mailjet.com
Port: 587
Connection security: STARTTLS (changed from None)
Authentication: Required
Username: [API Key]
Password: [API Secret]
Solution: SMTP Routes Configuration
Created route configuration in hMailServer to mark assettrackr.co as a local domain.
Location in hMailServer:
- hMailServer Administrator → Routes → Add Route
Route Configuration:
Domain: assettrackr.co
Deliver to: Local delivery
This tells hMailServer that any email addressed to @assettrackr.co should be delivered locally to the mailbox, NOT sent out through the SMTP relay.
Files Created
/workspace/Projects/hmailserver-configuration/README.md
This file - project documentation
/workspace/Projects/hmailserver-configuration/ROUTING-SOLUTION.md
The solution documentation (this file)
/workspace/Projects/hmailserver-configuration/HMAILSERVER-CONFIG.md
Detailed configuration reference
Links & References
-
hMailServer SMTP Relay Configuration Guide: https://techssh.com/self-hosting/configure-hmailserver-with-smtp-relay/
- Section #4 covers SMTP routes configuration
- Demonstrates how to mark local domains vs remote domains
-
Mailjet SMTP Documentation: https://dev.mailjet.com/email/guides/transmission/smtp/
- SMTP relay endpoint: smtp-relay.mailjet.com
- Port 587 with STARTTLS
-
hMailServer Routes Documentation: https://www.hmailserver.com/documentation/latest/?page=routes
Testing
Test Performed
John sent an email from ProtonMail to john@assettrackr.co and confirmed:
- ✅ Email was delivered locally to the mailbox
- ✅ The ProtonMail sender address did NOT appear on the Mailjet relay account
- ✅ This confirms the routing fix is working correctly
Lessons Learned
-
SMTP relay configuration requires route definitions - Simply setting up the relay credentials isn't enough. You must explicitly tell hMailServer which domains should be delivered locally vs relayed.
-
Inbound emails shouldn't be relayed - Emails addressed to local domains should NEVER be sent out through an SMTP relay. They should be delivered directly to local mailboxes.
-
Security best practices:
- Always use STARTTLS or SSL/TLS for SMTP relay connections
- Never use "None" for connection security
- Regularly rotate API credentials
- Monitor relay usage to detect unauthorized access
Status
✅ RESOLVED
The SMTP routing has been configured and tested. Local domains are now properly delivered locally instead of being sent through the Mailjet relay.