11

I'm wanting to set up a secondary MX server using Postfix but I am wondering what is the best way to test this prior to putting into production (by adding its MX entry)?

One possible way is to test it with an entirely different domain name, ie buy a domain like "fake-test-domain.com" and set it up its DNS zone with ONLY this backup MX server.

Any easier way I can just force a mail server to send a message to this server before it's listed in DNS?

I don't think I can use the hosts file on the sending system because that wouldn't emulate an MX record, right?

pete
  • 743
thomasrutter
  • 2,656

3 Answers3

21

Just use a telnet session to test email delivery. As an example,

# telnet host.domain 25
Trying host.domain...
Connected to host.domain.
Escape character is '^]'.
220  ESMTP
HELO example.com
250
MAIL FROM:<user@example.com>
250 ok
RCPT TO:<user2@example.com>
250 ok
DATA

To: user2@example.com
From: user@example.com
Subject: a test message

Test message body.
.
250 ok
pete
  • 743
EEAA
  • 110,608
4

When telnet is not enough, or too tedious, I use SWAKS

eg:

 cat email-content.txt | 
 swaks --body - --helo localhost.localhomain --server mail.example.com:25 \
  --auth-user fred --auth-password flintst1 -tls \
  --h-Subject Pebbles  --to wilma@example.org
  --from 'fred@example.biz'
1

Your Answer is https://www.wormly.com/test-smtp-server/

it does exactly what you are asking for.