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

I have setup an SMTP server on port 10025. I wanted to test sending emails to it via the command line.

Is there a parameter I can give the mail command to use the smtp server on 10025?

echo hello | mail -s'testing' myemail@address.com ???

I do have a seperate smtp server running on port 25 as well but I don't want to be communicating with that one or switch it off.

Thanks for you time,
Mark

share|improve this question
    
mail does not use SMTP. It just calls /usr/bin/sendmail, which takes care of delivery. –  grawity Feb 12 '10 at 13:12
    
You can add sendmail parameters to it though via -f, can't you? –  Mark L Feb 12 '10 at 13:15

1 Answer 1

up vote 2 down vote accepted

For testing, just telnet to the port: cf. this sample SMTP.

Postscript If you want a one-liner, put the following with the requisite arguments in your path:

#!/bin/bash
from=$1; to=$2
echo EHLO $from
echo MAIL FROM: $from
echo RCPT TO: $to
echo DATA
echo Subject: Test $from $to
echo
echo Test message body.
echo .

And then pipe that script, with its two arguments, into telnet localhost 10025

share|improve this answer
    
Looks like you beat me...I like your page better, anyway. –  Paul Kroon Feb 12 '10 at 12:03
    
It just seems a shame that I couldn't have a 1-line command sitting in a bash script. Do you know of any other command-line smtp tools for sending? I've resorted to a PHP script for the moment :( –  Mark L Feb 12 '10 at 12:15

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.