Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Using Windows (2008) is there an easy command line tool that I can use to send a test email from a server to test the SMTP, user authentication, ports, etc... without writing my own?

share|improve this question

4 Answers 4

up vote 11 down vote accepted

Your best, easiest and most globally available tool: telnet

  1. At command prompt, type: telnet mail.mailserver.com 25
  2. Type EHLO , and then press ENTER.
  3. Type AUTH LOGIN. The server responds with an encrypted prompt for your user name.

    Enter your user name encrypted in base 64. You can use one of several tools that are available to encode your user name.

    The server responds with an encrypted base 64 prompt for your password. Enter your password encrypted in base 64.

  4. Type MAIL FROM:sender@domain.com, and then press ENTER. If the sender is not permitted to send mail, the SMTP server returns an error.

  5. Type RCPT TO:recipient@remotedomain.com,and then press ENTER.If the recipient is not a valid recipient or the server does not accept mail for this domain, the SMTP server returns an error.

  6. Type DATA.

    If desired, type message text, press ENTER, type a period (.), and then press ENTER again.

    If mail is working properly, you should see a response similar to the following indicating that mail is queued for delivery:

    250 2.6.0 MAILID-SOMETHINGHERE@mail.somedomain.com.

Quoted in part from this MS Technet article

share|improve this answer
    
haha, I don't quote know if this is "easy" but it's certainly a fairly foolproof method. –  Mark Henderson Aug 5 '09 at 4:09
    
It is easy enough... luckily I didn't need to do authentication (local server) so I didn't have to worry about the base64 encoding, although many sites are available that can help me with that if necessary. –  Jason Aug 7 '09 at 1:02

If this is something that you have to test once in a while, or just for a small number of SMTP servers, then telnet may be the most convenient tool, as it has been pointed out. The best thing about telnet is that it's an almost universal tool, and that it allows you not only to test an SMTP server but also other services like POP, IMAP, etc.

However, if you're performing this tests regularly or on a bigger scale, i'd highly recommend using swaks. It's extremely easy to use and can also perform other tasks like sending attached files (which can be useful for testing your mail content filters).

It will also give you useful exit codes, so that you can even use it to perform automated tests.

I use it frequently on Linux, but being a Perl script, you should be able to run it on a Windows box without any problems.

share|improve this answer

Telnet to port 25 and issuing SMTP commands by hand is usually fine for this purpose.

share|improve this answer

If you don't want to manually run through the entire SMTP transaction you can use a command line tool such as blat to send emails.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.