This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Real-World ssmtp


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
  -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
  -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

(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 

% pppInfo

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

% pppDNS

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

Attachment: ssmtp-ppp-config
Description: Binary data

Attachment: sendmsg
Description: Binary data

Attachment: pppIdent
Description: Binary data

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]