1837981 Members
1960 Online
110124 Solutions
New Discussion

Re: sendmail question

 
wvsa
Regular Advisor

sendmail question

Good afternoon all,

Have a question regarding sendmail. Is there a way to create a aliase within sendmail so when a job is run in cron as root the message indicates it is from h_hosea as opposed to root. Right now all messages coming from our unix servers indicate the sender being root@ourdomain.org would like to have sender indicate the name of the server; eg h_hosea@ourdomain.org.

Hope this makes sense, any input would be helpful. Thank you for help


WVSA
5 REPLIES 5
Deoncia Grayson_1
Honored Contributor

Re: sendmail question

If I'm understanding the question correctly, then the cron job would have to be ran from the user with cron permission and not be ran as root. For example:

You can add a user to the cron.allow list, login as that particular user and do a crontab -e, add the job and when the email comes out it will come from that user instead of root.

Hope this helps.
If no one ever took risks, Michelangelo would have painted the Sistine floor. -Neil Simon
Steven E. Protter
Exalted Contributor

Re: sendmail question

The mailx command has the ability to specify the sender:

Assuming your cron entry looks like this:


* * * * * 1 /usr/contrib/bin/script 2>&1 mailx -s "Subject" someone@your.net

change it to:

* * * * * 1 /usr/contrib/bin/script 2>&1 mailx -r h_hosea@ourdomain.org -s "Subject" someone@your.net


Whether the email is accepted by the outside world will depend on whether the domain name is public and fully qualified.

Also note that outside systems like mine and aol's will not accept email from systems without valid reverse lookup addresses.

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
Sanjay_6
Honored Contributor

Re: sendmail question

Hi,

You can use the -r reply_to_add@domain.com with the mailx command and the mail would be shown as being sent by reply_to_add@domain.com to the user receiving the mail.

some_cron_job |mailx -s "subject" -r h_hosea@ourdomain.org email_addresses

Hope this helps.

Regds
Sanjay_6
Honored Contributor

Re: sendmail question

Hi,

If you need to do this for more number of userids, you can use the userdb database to do the masquerading. Take a look at this thread from itrc on how to configure and user userdb database to change the sender info,

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000068402500

The itrc doc id is KBRC00010421.

Hope this helps.

Regds
KapilRaj
Honored Contributor

Re: sendmail question

Compose the following and then append ">>" ur info to be sent and invoke "sendmail -t

From:kapilraj@kapil.com
To:kapilraj@kaps.com
Subject:Test Email
>>>>>>>>
>>>>>>>>
Appended contents
>>>>>
>>>>>

save the above file onto /tmp/letter$$
then
sendmail -t /tmp/letter$$

I use this in aix but it must have the same syntax in hp as well ...

Sendmail has another switch called "-f" thru which u can send an email as a diffrent id

Kaps
Nothing is impossible