From owner-freebsd-questions@FreeBSD.ORG Fri Aug 31 01:15:24 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5557C16A417 for ; Fri, 31 Aug 2007 01:15:24 +0000 (UTC) (envelope-from xrayv19@yahoo.com) Received: from web58104.mail.re3.yahoo.com (web58104.mail.re3.yahoo.com [68.142.236.127]) by mx1.freebsd.org (Postfix) with SMTP id 1D25A13C45A for ; Fri, 31 Aug 2007 01:15:23 +0000 (UTC) (envelope-from xrayv19@yahoo.com) Received: (qmail 96843 invoked by uid 60001); 31 Aug 2007 01:14:55 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=SIAA/T1/fbjZH2fBDDG5nBIQ82EkGadUYDwTH8lA7JFEa+AUHGEp4W8jIv7bcjxhe6LjzPFGszZszkDG8gOMpfXYuGjgY0C7sbaX8hAzKi63FFSsjxDegJfHxZxdFYOYwO/GJZBGNrKCzQ4JrRrhsQ9CWgrbT64ZvkYMWgJJs18=; X-YMail-OSG: 06oUJ40VM1nEb8AZMzZ_0wYbM1640YsXCpFpJBjr4q9iAFFqhhj7nOEFdLjazPACVMf1o25DkHK19qbzoDeQi63PLvJMq4DZXNgC Received: from [131.191.82.223] by web58104.mail.re3.yahoo.com via HTTP; Thu, 30 Aug 2007 18:14:55 PDT Date: Thu, 30 Aug 2007 18:14:55 -0700 (PDT) From: L Goodwin To: Derek Ragona , Chuck Swiger In-Reply-To: <6.0.0.22.2.20070830194613.02635658@mail.computinginnovations.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <169381.93008.qm@web58104.mail.re3.yahoo.com> Cc: freebsd-questions@freebsd.org Subject: Re: Configuring FreeBSD 6.2 to use sendmail for sending only X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2007 01:15:24 -0000 --- Derek Ragona wrote: > At 07:01 PM 8/30/2007, L Goodwin wrote: > >Chuck, I'd prefer to have the script handle the > >mailing so I can test the script (with email send) > >manually, independent of cron. > > > >Still looking for specifics on setting this up and > a > >bourne shell script example that sends an email. > >Thanks! > > > >--- Chuck Swiger wrote: > > > > > On Aug 30, 2007, at 3:12 PM, L Goodwin wrote: > > > > I wrote a shell script that backs up the file > > > server. > > > > I would like to modify this script to email a > > > > notification message to a public email > address. > > > > > > Use cron, which will automatically email out the > > > results of your > > > script to any email address you like. > > > > > > > Seems like sendmail should do the job nicely, > but > > > I've never set it > > > > up before. > > > > > > > > What specific steps (including > network-specific) > > > need > > > > to be performed to get sendmail working for > > > outgoing > > > > mail only in a secure manner? > > > > > > Please see the fine Handbook: > > > > > > > > > > >http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mail.html > > > > > > Although, it is entirely reasonable to consider > > > using Postfix instead. > > > > > > -- > > > -Chuck > > > > > > > > Here is a sample script that you can use as a > template: ======================================================= > #!/bin/sh > > #define any commands you will use > MAILFILE=mymailfile > MAILFILE2=mymailfile2 > SENDTO=derek@computinginnovations.com > CCTO=derek@computinginnovations.com > MAIL=/usr/bin/mail > AWK=/usr/bin/awk > CAT=/bin/cat > TR=/usr/bin/tr > TEMPDIR=/tmp > > #make sure we have paths > export PATH=$PATH:/usr/local/sbin:/usr/local/bin > > cd $TEMPDIR > $CAT /etc/passwd | $AWK -F : '{ print $5 }' > > $MAILFILE > $TR -cd "\012-\172" < $MAILFILE > $MAILFILE2 > $MAIL -s "My list of real user names subject" > $SENDTO -c $CCTO < $MAILFILE2 ======================================================= Derek, your example brings up another question. Should I be calling "mail" or "sendmail", and which mail or sendmail should I invoke if there is more than one of either? Chuck's example calls sendmail in a path that does not exist on my system (my sendmail is in /usr/sbin/). I usually invoke whichever one is first in my path. One more question. Is it ok to run the script (and send the email) as user root, or should I create a user account with more limited permissions -- if so, what limits should I set? ____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC