Test smtp

#!/bin/bash
server=$1
port=$2
from=$3
to=$4
login=$5
password$6
function mail_input {
echo "ehlo $(hostname -f)"
echo "AUTH LOGIN "
echo "$(echo $5 | base64)"
echo "$(echo $6 | base64)"
echo "MAIL FROM: <$from>"
echo "RCPT TO: <$to>"
echo "DATA"
echo "From: <$from>"
echo "To: <$to>"
echo "Subject: Testing SMTP Mail"
echo "This is only a test. Please do not panic. If this works, then all is well, else all is not well."
echo "."
echo "quit"
}
mail_input
mail_input | nc $server $port