Operating System - HP-UX
1752815 Members
5929 Online
108789 Solutions
New Discussion юеВ

Re: how forward user cron failures and other mail messages to user email acct ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

how forward user cron failures and other mail messages to user email acct ?

I need to forward all user (sam1) mailx messages to user email id sam1@abc.com ? how to do it?
How can I test it.
good judgement comes from experience and experience comes from bad judgement.
10 REPLIES 10
Rita C Workman
Honored Contributor
Solution

Re: how forward user cron failures and other mail messages to user email acct ?

The /etc/mail/userdb and then run makemap command. Here's how:

cd /etc/mail

vi userdb

Edit file so it looks like this:

sam1:mailname sam1@abc.com
sam1@abc.com:maildrop sam1

Two lines with two colums in it seperated by tabs
Save the file

Then run:

makemap btree /etc/mail/userdb.db < /etc/mail/userdb

Should now send mail from user login_id sam1 to sam1@abc.com.

Rgrds,
Rita
Tingli
Esteemed Contributor

Re: how forward user cron failures and other mail messages to user email acct ?

Create a file .forward with the email address in it in user's home directory.
Steven E. Protter
Exalted Contributor

Re: how forward user cron failures and other mail messages to user email acct ?

Shalom,

.forward file could do the trick with the email address in it.

croncommand | mailx -s "jobname-desc" sam1@abc.com

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sammy_2
Super Advisor

Re: how forward user cron failures and other mail messages to user email acct ?

Thanks. Actually I mentioned cron but want to forward all messages to user sam1 to sam1@abc.com. Right now, Rita solution looks good but would like to see how to do with .forwar as well.
good judgement comes from experience and experience comes from bad judgement.
Patrick Wallek
Honored Contributor

Re: how forward user cron failures and other mail messages to user email acct ?

The .forward file must exist in the users home directory and contains a list of e-mail addresses to forward mail for that user to.

In this case the .forward file must exist in the home directory of the user 'sam1'. The .forward file MUST be owned by the user 'sam1'. The file should contain only:

sam1@abc.com

If you were to 'cat .forward' it should look like:

# cat .forward
sam1@abc.com

For more information do:

# man 5 aliases

and look for the section on the .forward file.
Sammy_2
Super Advisor

Re: how forward user cron failures and other mail messages to user email acct ?

Rita and others,
Can I do this in userdb file so I get email forwarded from 2 users to same email address.

I get duplicate key message. Is that a warning or error ?


=====userdb================
sam1:mailname sam1@abc.com
sam1@abc.com:maildrop sam1
#
mike1:mailname sam1@abc.com
sam1@abc.com:maildrop mike1
=====userdb================
makemap btree /etc/mail/userdb.db< /etc/mail/userdb

makemap: /etc/mail/userdb.db: line 2: key sam1@abc.com:maildrop: duplicate key
makemap: /etc/mail/userdb.db: line 4: key sam1@abc.com:maildrop: duplicate key

Thanks

good judgement comes from experience and experience comes from bad judgement.
Tingli
Esteemed Contributor

Re: how forward user cron failures and other mail messages to user email acct ?

I think you also can do it in /etc/mail/aliases file. You can set alias as an entry in the file.
Rita C Workman
Honored Contributor

Re: how forward user cron failures and other mail messages to user email acct ?

I have never done that.......but I think just might work.

Give it try and test it out.

Rgrds,
Rita
Rita C Workman
Honored Contributor

Re: how forward user cron failures and other mail messages to user email acct ?

...by the way - I love your quote!

/rcw