how to redirect system mail (particularly, cron mail) to a network mail address?

how to redirect system mail (particularly, cron mail) to a network mail address?

Post by Newbie JrSysAdm » Sat, 14 Jul 2001 00:07:20



on a server with solaris 8, nis and dns, where network mail functions
(i can use the 'mail' command to send myself messages to my internet

messages to the network mail address for each user.

what i would like to do is to have mail automatically append the

in /var/mail for network users of my local server. does anyone know
how to do this?

btw, looking at some of these cron mail messages, they suggest cron

"alias" issue, but i can't figure out how to get it to work.

much, much thanks to smart person out there.

 
 
 

how to redirect system mail (particularly, cron mail) to a network mail address?

Post by Jeremiah DeWitt Weine » Sat, 14 Jul 2001 01:48:55



> on a server with solaris 8, nis and dns, where network mail functions
> (i can use the 'mail' command to send myself messages to my internet

> messages to the network mail address for each user.

        /Only/ automatically generated mail, or all mail?  You could make
entries in /etc/aliases, like this:

but that would affect all mail (for the users thus listed, anyway).  
Alternately, you can set up sendmail to rewrite addresses, which is slightly
more involved but is probably the correct way, if you really want it done
for all users.

> what i would like to do is to have mail automatically append the

> in /var/mail for network users of my local server. does anyone know
> how to do this?

        Well, one thing you could do is write the cron jobs so that they
mail out the results themselves rather than letting cron do it.  For example,

rather than just
ls /path/to/dir

        And I would have sworn that cron supported an environment variable
that let you define who stuff got mailed to, but I can't find any reference
to it.

--
If mail to me bounces, try removing the "+STRING" part of the address.

 
 
 

how to redirect system mail (particularly, cron mail) to a network mail address?

Post by Harry Putna » Sat, 14 Jul 2001 02:05:14



> on a server with solaris 8, nis and dns, where network mail functions
> (i can use the 'mail' command to send myself messages to my internet

> messages to the network mail address for each user.

> what i would like to do is to have mail automatically append the

> in /var/mail for network users of my local server. does anyone know
> how to do this?

> btw, looking at some of these cron mail messages, they suggest cron

> "alias" issue, but i can't figure out how to get it to work.

Look into using `procmail'. Integrated into your mail setup, it is the
most powerfull small but might tool for processing mail in about any
way imaginable.  The five man pages that come with it do a creditable
job of explaining the syntax.  The .forward file is also part of it.
Which allows something as simple as

cat ~/.forward


to forward all mail to a users account to wherever.

The full .procmailrc file can manage just about any situation you can
think up.

Two packages are available on ftp.sunfreeware.com

procmail-3.11pre4.tar.gz
procmail.tar.gz            

ftp://ftp.sunfreeware.com:/pub/freeware/SOURCES

 
 
 

1. How do I delete mail from mail file /var/mail/su after reading mails

I used to receive data in mail from users. I used to read those data
and load that into a ORACLE table. However I am not able to delete
those mails after reading and loading it.

Currently I delete them manually when the mail file grow very big

Is there a way we can delete these mails after we read it using shell
script ?

2. CONFIG_IP_FORWARD exist in 2.2.3?

3. Moving mail from /var/mail to ~/mail?

4. deleting packages

5. Is there a mail program that can read mail (as root) from /var/spool/mail/xxx?

6. NCSA Web Server for SCO 5.0: GETMSG prob..

7. mail folder is in /var/mail or /var/spool/mail

8. Swap Space Question

9. Using mail/Mail to send HTML mail via SMTP

10. cron mail about new mail

11. set mail from address and mail reply adress in Unix command line

12. mail address in my mail

13. Unix mail to internet mail via network