Real-World ssmtp

Randall R Schulz rrschulz@cris.com
Fri Mar 14 16:37:00 GMT 2003


Hi,

I've found ssmtp to be useful for automated update announcements 
triggered by CVS check-in. It is, however, quite a bare-bones program. 
To make it convenient, I crafted some supporting shell scripts.

The primary one is "sendmsg," which allows common header content to be 
specified on the command line:

% sendmsg --help
Options:
  -s subjectString        # Establish the message's subject header
  -t recipientAddrress    # Add a primary recipient
  -c ccAddress            # Add a carbon-copy recipient
  -b blindCCAddress
  -bc blindCCAddress
  -bcc blindCCAddress     # Add a blind carbon-copy recipient
  -m messageBodyFile      # Specify a file containing message content
                          #   May be repeated. A single hyphen causes
                          #   the standard input to be be read
  -fn senderFullName
  -F senderFullName       # Establish the sender's full name
  -r replyToAddress
  -rt replyToAddress      # Establish a Reply-To: header
  -nd
  -nt                     # Do not add a "Date:" header field
  -d dateString           # Specify the contents of the "Date:" header
                          #   Note: Do not include the "Date: portion"
  -ppp                    # Re-create /etc/ssmtp/ssmtp.conf
  -q queueFile            # Enqueue message in specified queue file
  -pq queueFile           # Print headers of mail queued in specified queue file
  -sq queueFile           # Send mail queued in specified queue file
                          #   based on current PPP connection
  -h | -help | --help     # Show this usage summary


One complication I have stems from being a dial-in user whose ISP has 
some restrictions on accepting incoming SMTP mail for forwarding (in 
contrast with that destined for one of its subscribers). In particular, 
the mail must appear to come from the IP currently associated with the 
PPP POP over which the mail arrived.

The upshot is that the ssmtp.conf file must be edited for each new 
dial-in connection that's established. I wrote some scripts to do that, 
too. You can see a hint of their use in the "-ppp" option to sendmsg, above.

This automatic reconfiguration is done by the script "ssmtp-ppp-config." 
Note that this script doesn't really edit the ssmtp.conf file, it 
regenerates it. There's a hard-coded template embedded within it to do 
this regeneration.

% ssmtp-ppp-config
ssmtp-ppp-config: Usage: ssmtp-ppp-config [ option ... ]
   -v                      Be verbose
   -p                      Use current PPP host name (default)
   -d                      Use default local host name from
                             "$PROJ_ETC/localHost" ("/c/SD/etc/localHost")
   -h localHost            Specify the local host name
   -m mailHost             Specify mail delivery host name
   -fy | -foy | -floy      Allow From: override from message header
   -fn | -fon | -flon      Forbid From: override from message header
   -h | -help | --help     Display this usage summary


Ssmtp-ppp-config uses a simple auxiliary script "pppDNS" which is one of 
three "faces" (invocation name) of "pppIdent" the other two are "pppIP" 
and "pppInfo". When invoked as pppIdent it will give a usage diagnostics 
and make sure links to the primary invocation names (those mentioned 
above) exist:

% pppIdent
Usage: pppIP | pppDNS | pppInfo


% pppIP
1015> pppIP
66.238.120.163
192.168.136.1

(I see a problem here that's cropped up since I configured a new 
interface--both IP addresses are showing. This script or those that use 
it will need to be fixed, it seems. These command use the Windows 
"ipconfig" command (and I only tested on Windows 2K Pro) but it does 
call out PPP interfaces as such, so fixing this shouldn't be too big a 
problem.)


% pppInfo
PPP  IP: 66.238.120.163
192.168.136.1
PPP DNS: xo.283.238.66.in-addr.arpa

(The same problem shows up here and a bit more blatantly.)


% pppDNS
xo.283.238.66.in-addr.arpa


I've attached these three scripts. Maybe they'll be helpful to ssmtp 
users. Feel free to ask me for help in using them. I the multiple 
interface thing is a problem for anyone, give me a poke and I'll fix up 
that defect. As usual, they weren't written for completely 
general-purpose use and may not be suitable for all users (or any users 
besides me).

Generic ssmtp questions can stay on the Cygwin list. Questions about my 
scripts should go to me.

Randall Schulz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ssmtp-ppp-config
Type: application/octet-stream
Size: 3536 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030314/4f696542/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sendmsg
Type: application/octet-stream
Size: 8015 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030314/4f696542/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pppIdent
Type: application/octet-stream
Size: 763 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030314/4f696542/attachment-0002.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list