Wednesday, October 29, 2008

Add Mail Domain 2 - Telnet Testing

Verifying that mail is working on your new email domain using telnet to port 25

You probably do not have mx records pointed at your mail server for the new domain so use the telnet command to test connectivity with the mail server.

At a command prompt type:
set local_echo
open ServerNameOrIpAddress 25 (response 220

This puts you in a telnet session. Turning on local echo allows you to see what you are typing. If you have never had the experience; you can get connected to a telnet session and have all your typed text be invisible (not displayed on the screen). Everything still works but it makes the job more difficult. After the open command you are connected to your mail server and sending mail commands just as if it were coming from an outside mail server. If you make a mistake typing just hit enter and start over on that command, as backspaces are not understood.
FYI- if you need to break out of the telnet session with the mail server use the control right bracket key sequence to get out. "CNTL-]" this will dump you back to the telnet window where you can use the "open or o" command to try again.

Continue on with the following commands (you should see responses from the server):

ehlo (response 250 OK)
mail (response 250 OK - MAIL FROM ...)
rcpt (response 250 OK - Recipient ...)

Use ehlo or helo to tell the server what server is trying to connect. Use a valid address for the "mail from" part so that if it does not work you should get a bounce message back to your mailbox. The rcpt to: part is where you put the address of your mailbox using the new email domain name you are trying to test.
The next command is the word "data" on a line by itself:

data (response 354 Send data...)

No responses will come for the following commands
From: "Bob Example" <>
To: Alice Example <>
Date: Tue, 15 Jan 2008 16:02:43 -0500
Subject: Test message
Body of test message
. (period and enter key on blank line - response 250 OK)
Quit (response 221 closing connection)

OK, you do not need the lines From:, To:, Cc:, and Date:
For a quick test message I usually just put the line -> Subject:test
Next you have to put a period on a line all by itself (this signals the end of the message)
Type quit on the next line to end the session and the message should get sent.

If this all works you should be OK as long as outside mail server can connect to your smtp mail server. You just need to have you MX records for the mail domain pointed at your server so that mail can come in from outside.

Here is a link to some information about MX records.

No comments: