1847882 Members
3448 Online
104021 Solutions
New Discussion

sendmail setup help

 
Zee
Advisor

sendmail setup help

I need some help on this..

I want user "oracle" in the hpux11.00 system to be able to send messages/emails to the users within the company like user@companydomain.com.
I dont want "app" to receive any messages from outside but only want it to send some alerts to the users.

Can sendmail be used to achieve this ? any help on setting up send mail ?

Many Thanks in advance.





8 REPLIES 8
Naveej.K.A
Honored Contributor

Re: sendmail setup help

Hi,

You have to configure the smart relay host for the sendmail to relay messages to other domains.

/etc/mail/sendmail.cf is the configuration file and have to modify the DS directive.

DSsmartrelayhost.yourdomain.com

and then restart the sendmail

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

You can send a test mail and see if its working.

cat testfile | mailx -s 'test mail' emailaddress@externaldomain.com

Regards,
Naveej
practice makes a man perfect!!!
Peter Godron
Honored Contributor

Re: sendmail setup help

Zee,
Can you please clarify:
1. Have you got mailx sending messages already (i.e. is sendmail installed, ll /usr/sbin/sendmail)
2. The messages are to be sent from the oracle user, who runs an application.
3. Any reply messages from the users are to be 'bounced'. What do you want to do with any such message (delete,forward to Sys.Admin)?

Regards
Zee
Advisor

Re: sendmail setup help

Hi Peter,

answers to your question.

1) yes, sendmail is already installed on the box
2) yes, messages are to be sent from oracle user.
3) delete.

Thanks,
Peter Godron
Honored Contributor

Re: sendmail setup help

Zee,
thanks for the info.
If your SMTP gateway (the box that talks tot he outside world) is correctly set up, any message trying to return should be deleted.
Perform Naveei's changes; What currently happens if you try to send a message from within the application. Best to track the status via the
tail -f /var/adm/syslog/mail.log command.
For additional reading:
http://www.sendmail.org/~ca/email
in particular:
http://www.sendmail.org/~ca/email/protected.html
Regards
Naveej.K.A
Honored Contributor

Re: sendmail setup help

Hi,

1) yes, sendmail is already installed on the box
You may follow the instructions given in my first reply

2) yes, messages are to be sent from oracle user.
you can use mailx or sendmail command to send messages to the external email address

3) delete.
create a file, .forward (read as dot forward) in the home directory of the user oracle and mention /dev/null. But this will remove all the mails send to the oracle user (both internal and external)

Regards,
Naveej
practice makes a man perfect!!!
Steven E. Protter
Exalted Contributor

Re: sendmail setup help

As long as you don't run the sendmail daemon on the server, mail will not be able to get back to the oracle user.

/etc/rc.config.d/mailsvrs

Make sure first variable is set to 0.

That will disable sendmail. Its still theoretically possible to get mail onto the box but more difficult.

If that doesn not work for you the other solutions will be just fine. SMTP gateway allows your mail configuration to be centralized.

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
Zee
Advisor

Re: sendmail setup help

Thanks you all, I'll try your suggestion and will update this thread with points very soon.

renarios
Trusted Contributor

Re: sendmail setup help

Hi Zee,

I use the following function to mail (with logfile attached) as oracle in case of a failure in a script.
I use the -r option to give the sender a different name.

SENDER="user@companydomain.com"
function f_retval
{
if (( $? > 0 ))
then
printf "\a \n Error occurred in function ${fname} \n \n" >> ${LOGFILE}

SUBJECT=" Error in execution of ${fname} in ${SCRIPTFILE}"


/usr/bin/mailx -r ${RETURN_ADDRESS} -m -s "${SUBJECT}" ${RETURN_ADDRESS} <<-EOF
$(ux2dos ${LOGFILE} | uuencode ${LOGALIAS})
Hi,

An error in script ${SCRIPTFILE} occurred while running function $fname

The logfile ${LOGALIAS} is attached to this document.

This email message was created automatically by UNIX

EOF

exit 102
fi
}
Hope it helps,

Renarios
Nothing is more successfull as failure