Using ssmtp to send email as a different user (-f doesn't seem to be working)

thomas.revell@powerconv.alstom.com thomas.revell@powerconv.alstom.com
Mon Mar 21 18:14:00 GMT 2005


Hi everyone,

Apologies if I'm missing something really obvious here, but I can't seem 
to get ssmtp to use the -f option, to change the address to send from. My 
situation is like this:

I'm currently working on a number of shell scripts, which must send email 
in certain situations. Due to email policy restrictions where I work, 
these messages must be sent from one specific email address, in the form 
foo@bar.somewhere.com (this isn't the actual address, as you probably 
guessed). However, the user foo does not exist as an actual user account, 
and the computer concerned is not called bar.somewhere.com. I've got the 
rewriteDomain option set up to correctly set the domain, but I cannot seem 
to set the name. Running ssmtp as /usr/sbin/ssmtp -ffoo doesn't seem to be 
working, as the address that ssmtp is attempting to send from is 
<username>@bar.somewhere.com, which is being rejected by the email server. 
I have managed to sucesfully get the system working for individual users 
using the reverse aliasing feature, but I really don't want to have to set 
this up for every user who will use the system. The contents of my 
/etc/ssmtp/ssmtp.conf file are as follows:

#
# /etc/ssmtp/ssmtp.conf -- a config file for sSMTP sendmail.
#

mailhub=mailserver.internaladdress.bar.somewhere.com
FromLineOverride=no
hostname=mypc.internaladdress.bar.somewhere.com
rewriteDomain=bar.somewhere.com
root=postmaster

# Configure sSMTP in Six Easy Steps
# 
# (1) mailhub
# This is the computer responsible for handling your outgoing mail.
# It could be the SMTP server of your ISP, or a departmental mailhub.
# Use the fully-qualified domain name (foo.bar.baz) of the mailhub;
# if it uses an unusual SMTP port number, use the colon syntax
#   foo.bar.baz:2525
# Otherwise sSMTP will use the standard SMTP port number (25).
# (Note that sSMTP can support a user-dependent mailhub with the
# 'reverse aliases' feature, for which see the man page.)
# 
# (2) FromLineOverride
# This specifies how sSMTP handles the From: line of outgoing mail.
# If FromLineOverride=YES, sSMTP will leave the From: line alone if
# it already exists.  If FromLineOverride has any other value, or
# there is no From: line, sSMTP creates the From: line using your
# username (or the -f command-line option), and the value of the
# rewriteDomain option (step (4), below).
#     If you use a mail user agent (MUA; e.g. mutt, pine) I recommend
# using YES and having the MUA set the From: line.  (Exception: the
# 'reverse aliases' feature can be used to set up a particular From:
# address for each user, in which case don't use FromLineOverride=YES.
# See the man page.)
# 
# (3) hostname
# sSMTP uses the hostname of your computer to identify itself to the
# mailhub, and in the Received: headers of the outgoing mail.  This
# has relatively little effect on how the mail is handled.
#     Use the fully-qualified domain name (FQDN) of your computer
# (foo.bar.baz).  If it doesn't have a FQDN, use some name for your box.
# 
# (4) rewriteDomain
# Please enter the mail name of your system.
# sSMTP uses this value to add a domain to unqualified e-mail addresses
# (addresses without an @-sign).
#     You probably want to use the domain from your own e-mail address.
# You probably want to set up your MUA to handle unqualified addresses
# itself, in which case sSMTP will never have to use this.  (Users of
# cron note that cron always uses unqualified addresses.)
# 
# (5) root
# If sSMTP finds an unqualified e-mail address among
# the recipients, and it corresponds to a username on your local
# machine with a userid less than 1000, then the e-mail is sent to
# this value instead.  The idea is that mail sent to 'root' should
# probably go to 'postmaster' instead.
#     If you set up your MUA to do its own handling of unqualified
# addresses, this is irrelevant.  (But note that cron does use
# unqualified addresses corresponding to local usernames.)
# Use your own e-mail address unless you know a better postmaster.
# 
# (6) link /usr/sbin/sendmail to /usr/sbin/ssmtp?
# Some programs (e.g. cron) expect /usr/sbin/sendmail to handle mail.
# You may wish to ensure that it is a symbolic link to /usr/sbin/ssmtp.

Any advice will be much appreciated.

Regards,

Thomas Revell
:.________________
CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and 
may be privileged. If  you are not a named recipient, please notify the 
sender immediately and do not disclose the contents to another person, use 
it for any purpose or store or copy the information in any medium.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list