Creating wrapper script for Mail.app to send mail from Terminal
Do you need to use Mail.app, or is your goal just to send an email message? If it's just to send an email message from the Terminal, you can use the sendemail command-line utility.

/usr/local/bin/sendemail 
 -f from@my.email.com 
 -t my.recipient@their.email.com 
 -s your.smtp.server:port 
 -xu smtp.username.here 
 -xp smtp.password.here 
 -m message.body.goes.here


Obviously in Terminal all of that will need to go on a single line, with appropriate escapes and string quoting. You can look at the man page for sendemail for more options.