Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

sending mail to my exchange server

SOLVED
Go to solution
Jim Mickens
Frequent Advisor

sending mail to my exchange server

Is there any way to set up HP-UX v10.20 to send output from crontabs and HPDPS messages to my Exchange users, instead of having undeliverable messages pile up in root's elm box?
14 REPLIES
Tommy Brown
Respected Contributor

Re: sending mail to my exchange server

We use a ".forward" file in the users home directory to forwards mail to the Echange server. eg. user@mail. The sendmail.cf file must also be modified..
Tommy
I may be slow, but I get there !
Rick Garland
Honored Contributor

Re: sending mail to my exchange server

Define a "Smart Host". This way all e-mail from the HP system is sent to the Exchange server and Exchange does the name lookups. Also defined an alias for root so that mail comes to my personal mailbox with info as to which system sent it.
You may also want to look at the DLname_of_luser_relay. This says that I don't know anybody on the system and I am going to forward all e-mails to the DL.

These options exist in the /etc/mail/sendmail.cf file. Do make a copy of the original sendmail.cf file and once changes are in place, kill the sendmail daemon and restart it
This will reread the mail config file.
ps -ef | grep mail
kill
/usr/lib/sendmail -bd -q15m
Jim Mickens
Frequent Advisor

Re: sending mail to my exchange server

So to define the Smart Host, would I use the Exchange server's name (e.g. mauemail), or the SMTP connector's incoming mail name (e.g. mau.opinionresearch.com)? Or does it matter, as long as what I use is defined in the host table?

What if all users do not reside on the same Exchange server? Would the .forward option be the best way to go? I've never done this stuff before, so I'm going to need some more detailed information.
Rick Garland
Honored Contributor

Re: sending mail to my exchange server

The Smart Host would be defined as the exchange server's name
i.e., DShostname.domain.com - the luser_relay would also be the exchange server hostname.

If all users are not on this exchange server, is it setup to forward those e-mail boxes to the server they reside on? If so, the UNIX mail still does not know anybody on the UNIX system - all mail gets forwarded to the exchange server and the exchange server will do the name lookups and forward accordingly.

On the UNIX system, define the Smart Host at the least. Mail from the UNIX system will be forwarded to the exchange server.

After defining the Smart Host in the /etc/sendmail.cf file, be sure to stop and restart the mail daemon.
Rodwell B. Watson
Occasional Visitor

Re: sending mail to my exchange server

You can set up the smart relay in /etc/mail/sendmail.cf by uncommenting the line

DS[xxx.xxx.xxx.xxx]

where you insert the IP address for your exchange server.

The easiest way, however, is to just to put an entry in /etc/hosts:

xxx.xxx.xxx.xxx companyname.com

where you supply the appropriate domain name. Then use the following shell script:

#!/usr/bin/sh
SUBJECT="Forward mail from HP-UX"
ACCOUNTS=`find /var/mail -mtime +1 -print`
for ACCOUNT in $ACCOUNTS; do
NAME=`echo $ACCOUNT|cut -c 11-`
EMAILTO="${NAME}@companyname.com"
if [[ -n $NAME ]];then
mailx - "$SUBJECT" "$EMAILTO" <"$ACCOUNT"
rm "$ACCOUNT"
fi;
done

This script is then executed maybe once an hour in crontab. You might adjust the script because the way it is now written it forwards all mail older than a day to the exchange server. It also assumes that user names are the same on the exchange server as on the the hp-ux. If this is not the case then you could set up a switch table to get the names.

In order to reference the exchange server in /etc/hosts only, you must set the line in /etc/mail/service.switch to:

hosts files

For more information on these issues look at the sendmail web site, www.sendmail.org
Rick Garland
Honored Contributor

Re: sending mail to my exchange server

Define the Smart Host as described. What I do is setup the /etc/mail/aliases file as well. Example, all of our mail goes through Exchange and the mail is produced on the individuals Outlook mail app. In using the aliases file, I have setup root mail to be aliased to me so I receive all of the mail that is directed to the root account.

I let few people know I have done this because I do not want to be maintaining the aliases file. There are only a couple of entries in there that are fairly static and do not require regular updating.

Re: sending mail to my exchange server

You can also add the following line at the beginning of /usr/mail/root:

Forward to user@exchange.company.com

(replace this with whatever user you want root's mail to go to).

I hope this helps.

Jim Mickens
Frequent Advisor

Re: sending mail to my exchange server

Thanks to everyone for all your help. I finally had the time to do this, and it appears to be working. The problem I have now is that all messages from HPDPS are coming into the Exchange server as attachments on a message that says: "This message uses a character set that is not supported by the Internet Service. To view the original message content...". I then have to open the message.txt attachment to read the original message.
Thierry Poels_1
Honored Contributor
Solution

Re: sending mail to my exchange server

hi,

edit /usr/share/lib/mailx.rc and add/change:
set charset=us-ascii

good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Jim Mickens
Frequent Advisor

Re: sending mail to my exchange server

Now for the next problem:
I tried testing the .forward file for forwarding to individual users' mailboxes, but it doesn't seem to want to work. As a test, I used the 'support' account and put my e-mail address in the /home/support/.forward file. Is there a specific way that file is supposed to be set up? Existing file:
# more /home/support/.forward
jmickens@mau.opinionresearch.com

I can send to this address directly, but when I send to the support account, it does not forward.
Thierry Poels_1
Honored Contributor

Re: sending mail to my exchange server

hi Jim,
next solution ;) :
check the .forward file's privileges, I believe it may/must only be read-only.
An other option is to use aliases; edit /etc/mail/aliases, add an alternative address for the concerning user, execute "newaliases" and bingo :)
good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Richard Darling
Trusted Contributor

Re: sending mail to my exchange server

Hi Jim, I go it to work for me doing two things:
1) Adding an entry for my exchange server to my /etc/hosts file of my UNIX box:

192.168.100.5 server1 # NT Server 1

2) Edited my /etc/mail/sendmail.cf file:

# "Smart" relay host (may be null)
DSserver1

3) In Outlook added "Tools", "Rules", enter the user who will be sending mail from the UNIX box (ex. root@L1000), and apply the rule to forward it to the email address of the party that you want to receive it.

3) Test it using the command:
root:L1000>:sendmail -v rdarling@southwickclothing.com
test
"ctrl d" or a period "." on a blank line

Richard Darling
rdarling@southwickclothing.com
Richard Darling
Trusted Contributor

Re: sending mail to my exchange server

Sorry Jim,
I posted my reply on the wrong thread...please disregard.
RD
rdarling@southwickclothing.com
Jim Mickens
Frequent Advisor

Re: sending mail to my exchange server

I changed the .forward file to be read only, but it's still not forwarding. It is also owned by the appropriate account. I was trying to avoid using the alias file method so I didn't have to keep changing it with new users. That method does work, so I guess I don't have a choice.