Configuring FreeBSD 6.2 to use sendmail for sending only

Derek Ragona derek at computinginnovations.com
Thu Aug 30 18:00:35 PDT 2007


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 <cswiger at mac.com> 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 at computinginnovations.com
CCTO=derek at 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

=======================================================




>
>____________________________________________________________________________________
>Be a better Heartthrob. Get better relationship answers from someone who 
>knows. Yahoo! Answers - Check it out.
>http://answers.yahoo.com/dir/?link=list&sid=396545433
>_______________________________________________
>freebsd-questions at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
>MailScanner thanks transtec Computers for their support.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



More information about the freebsd-questions mailing list