Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- From: L Goodwin <xrayv19@xxxxxxxxx>
- Date: Thu, 30 Aug 2007 18:14:55 -0700 (PDT)
--- Derek Ragona <derek@xxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
At 07:01 PM 8/30/2007, L Goodwin wrote:=======================================================
Chuck, I'd prefer to have the script handle thea
mailing so I can test the script (with email send)
manually, independent of cron.
Still looking for specifics on setting this up and
bourne shell script example that sends an email.address.
Thanks!
--- Chuck Swiger <cswiger@xxxxxxx> wrote:
On Aug 30, 2007, at 3:12 PM, L Goodwin wrote:
I wrote a shell script that backs up the fileserver.
I would like to modify this script to email a
notification message to a public email
but
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,
network-specific)I've never set it
up before.
What specific steps (including
need
to be performed to get sendmail working foroutgoing
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@xxxxxxxxxxxxxxxxxxxxxxxx
CCTO=derek@xxxxxxxxxxxxxxxxxxxxxxxx
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
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- From: Chuck Swiger
- Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- From: Derek Ragona
- Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- References:
- Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- From: Derek Ragona
- Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- Prev by Date: Re: FreeBSD Hostname Question - Whats The Proper Way
- Next by Date: Re: FreeBSD Hostname Question - Whats The Proper Way
- Previous by thread: Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- Next by thread: Re: Configuring FreeBSD 6.2 to use sendmail for sending only
- Index(es):
Relevant Pages
|