Entries Tagged as 'SYSK'

SYSK - Test your SMTP mail server with telnet

Network packet trace of SMTP connection
Creative Commons License photo credit: TalkingTree
When troubleshooting email, it may be necessary to see what the email server is spitting out, just to make sure everything is working. The easiest way to do that is to use the telnet command. Telnet allows you to connect to various services on remote or local machines through the command line. Today we are going to be using it to send some email. You’ll first need to bring up the command-line on your respective operating system. First see if telnet is installed. Type:
telnet
And you should see something like this:

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet>�
Or this:
telnet>
Since that works, type quit to exit telnet. Next, we need to open a connection to our mail server. We will need to know the name or ip address of the mail server:
telnet mail.example.com 25
(The 25 is the port number that SMTP runs on.) You should then get a response back from your mail server:

Trying 10.0.0.18...
Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix

The server is now waiting for a command. We need to say Hello. (* For the remaining examples I’m going to use the domain example.com. You’ll need to replace that with your local domain name. *)
helo example.com
Which returns:
250 mail.example.com
The mail server now needs to know who is sending the email:
mail from: myname@example.com
Returns:
250 Ok
Who are you sending the mail to?
rcpt to: recipient@example.com
Returns:
250 Ok
Now it is time to tell it the message:
data
Returns:
354 End data with .
Enter your message:

Subject: test message
This is a test message
.

To end the message, you need to put a period at the beginning of the line and hit the return key. Now your message is on its way!
Now type quit to exit
quit

Skills You Should Know (SYSK) - vi

I’m starting a new category, that goes along with my blog post Yes I will lead. The new category is called Skills You Should Know - SYSK. Little bits of information that through my experience aren’t something that you may not necessarily use every day, but may someday save you a ton of trouble.

Today’s topic is vi. Vi may be the only editor installed on a new unix based system, and a few commands will get you to the point where at least you can edit a few files before installing something a little more user friendly such as pico (or nano).

Vi has two modes, command and insertion. It was designed this way because sometimes the keyboard you would be using might not necessarily have all the keys we take for granted today, especially when it comes to the arrow keys. In command mode you can move the cursor around with the arrow keys or hjkl keys. To do an editing, you’ll need to switch to insertion mode. Vi defaults to command mode when it is started.

i - Switches to insertion mode
<ESC> - Switches to command mode

In a nutshell, you’ll start the editor with a file:

vi somefile

Once the file is open, you’ll press i to switch to insertion mode. Make the changes to your file. Press <ESC> to switch back to command mode. To exit you’ll press the following (these all start with the colon):

:wq - Write the file and then quit
:q! - Quit the file without saving the changes. A great way if you mess up and just want to not save your changes

These preceding commands should at least get you started. For more info, you may want to visit the following pages:
vi - Wikipedia, the free encyclopedia
Vi Cheat Sheet
Mastering the VI editor