changing "From" header in a script

der.hans plug-discuss@lists.plug.phoenix.az.us
Tue, 21 Jan 2003 11:15:27 -0700 (MST)


Am 21. Jan, 2003 schw=E4tzte Lynn David Newton so:

> I have a need to change the "From" header in email from
> within a script. Does anyone know -- is formail(1) the
> key to doing that, or something else? We have a daily
> cron job run as root we'd like to filter specially.

man 5 crontab

       An  active line in a crontab will be either an environment setting o=
r a
       cron command.  An environment setting is of the form,

           name =3D value



       In addition to LOGNAME, HOME, and SHELL, cron(8) will look at MAILTO=
 if
       it  has  any  reason  to  send  mail as a result of running commands=
 in
       ``this'' crontab.  If MAILTO is defined (and non-empty), mail  is se=
nt
       to  the  user so named.  If MAILTO is defined but empty (MAILTO=3D""=
), no
       mail will be sent.  Otherwise mail is sent to the owner of the cront=
ab.

Set MAILTO to whatever you want it to be before the cronjob.

You just want it for this particular cronjob, though, right?

15 2 * * * MAILTO=3DMyVerySpecialAddy@someplace.org /usr/local/sbin/myJob.s=
h

Check also the EMAIL variable if MAILTO isn't doing what you want.

cioa,

der.hans
--=20
#  https://www.LuftHans.com/    http://www.TOLISGroup.com/
#  Help Jerry Lewis stamp out M$...oops that's MDA - der.hans