#!/bin/sh #This script can be used to setup To:, From:, Subject: and execute #an email client. In this example, smtpclient will read the email #body from stdin. You could run this in xterm like this: # #xterm -geometry 50x20+10+30 -e mysmtp "%s" you@yourisp.com "%s" # #pop3eye will insert the To: and Subject: fields. #Initialize variables sub="No Subject" to="" from="whoknows@frys.com" # get To: field from first arg if [ -n "$1" ]; then to="$1" fi read -p "To: [$to] " ans #if you changed it, use that if [ -n "$ans" ]; then to="$ans" fi #get From: field if [ -n "$2" ]; then from="$2" fi read -p "From: [$from] " ans #if you changed it, use that if [ -n "$ans" ]; then from="$ans" fi #get Subject: field if [ -n "$3" ]; then sub="$3" fi read -p "Subject: [$sub] " ans #if you changed it, use that if [ -n "$ans" ]; then sub="$ans" fi #Now execute the client and receive the body text from stdin #Press Ctrl-D to end input. Ctrl-C to abort. smtpclient -s "Re: $sub" -f "$from" -S mail.frys.com "$to" if [ $? -eq 0 ]; then echo "Done" sleep 2 else echo "Error" sleep 999 fi