Sendmail and MS Exchange

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
-leliel-
Apprentice
Apprentice
Posts: 294
Joined: Sat May 03, 2003 6:51 pm
Location: Germany

Sendmail and MS Exchange

Post by -leliel- »

Hi,

I want to send mail with sendmail through a MS Exchange server (relay).

How do I login to this server using sendmail??

ehlo output of the exchange server:
250-ex.domain.com Hello [172.28.0.1]
250-XEXCH50
250-HELP
250-ETRN
250-DSN
250-SIZE 8192000
250-AUTH LOGIN
250 AUTH=LOGIN
Thanks a lot.
User avatar
kashani
Advocate
Advocate
Posts: 2030
Joined: Mon Sep 02, 2002 6:38 am
Location: San Francisco
Contact:

Post by kashani »

Sendmail is an MTA much like Exchange itself. I suppose you could hack something together to make Sendmail login into Exchange, but I'm not sure that you would need to. You would need to tell Exchange that the IP address of your Sendmail machine is allowed to relay mail and then configure Sendmail to use Exchange as the relay.

Unfortunately, I've usually done it the other way around for scalibitlity reasons. :)

kashani
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
-leliel-
Apprentice
Apprentice
Posts: 294
Joined: Sat May 03, 2003 6:51 pm
Location: Germany

Post by -leliel- »

Well, I have to write a script to automatically send mails.

Code: Select all

/usr/sbin/sendmail -t -n << EOF
From:blubb
To:abc
Subject:test
abcde
EOF
This mail should be relayed through the exchange server.

Any Ideas?

I found a howto, but the mail will not be send cause sendmail couldn't find the dns hostname of the exchange server. :(

Thanks a lot
User avatar
Liathus
Apprentice
Apprentice
Posts: 163
Joined: Fri Mar 21, 2003 3:19 am
Location: Fargo, ND

Post by Liathus »

You will need to turn smtp relaying on for the IP address of the machine running sendmail.
After that you will need to tell sendmail to use the exchange server to deliver messages instead of doing so directly. You can do this in sendmail.cf or if you are scared of that file like me you could use webmin :)
-leliel-
Apprentice
Apprentice
Posts: 294
Joined: Sat May 03, 2003 6:51 pm
Location: Germany

Post by -leliel- »

this is a part of the logfile:
Aug 14 18:08:10 proxy2 sendmail[9337]: alias database /etc/aliases rebuilt by root
Aug 14 18:08:10 proxy2 sendmail[9337]: /etc/aliases: 40 aliases, longest 10 bytes, 395 bytes total
Aug 14 18:08:10 proxy2 sendmail[9350]: starting daemon (8.11.6): SMTP+queueing@01:00:00
Aug 14 18:08:32 proxy2 sendmail[9354]: h7EG8Tu09354: from=root, size=6, class=0, nrcpts=1, msgid=<200308141608.h7EG8Tu09354@localhost.localdomain>, relay=root@localhost
Aug 14 18:08:32 proxy2 sendmail[9354]: h7EG8Tu09354: to=test@domain.com, ctladdr=root (0/0), delay=00:00:03, xdelay=00:00:00, mailer=esmtp, pri=30006, relay=172.20.1.78, dsn=5.1.2, stat=Host unknown (Name server: 172.20.1.78: host not found)
I also changed /etc/nsswitch.conf:

hosts: files [NOTFOUND=continue] dns

to search the /etc/hosts firstly but it's not working at all. :(
User avatar
kashani
Advocate
Advocate
Posts: 2030
Joined: Mon Sep 02, 2002 6:38 am
Location: San Francisco
Contact:

Post by kashani »

Looks like DNS resoltuion problems. Add an entry for the 172.x.x.x machine into your /etc/hosts and then change your smart relay to the host name you've entered.

kashani
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
User avatar
thorne
Apprentice
Apprentice
Posts: 177
Joined: Thu Sep 19, 2002 7:33 am
Contact:

Post by thorne »

-leliel- wrote:I found a howto, but the mail will not be send cause sendmail couldn't find the dns hostname of the exchange server. :(
Hi... could you post a link to this how-to? I'm trying to setup bugzilla to go through an exchange server, but it only works with sendmail (or so I have read,) so I would like to know how to do this.

Thanks.
Stupid bug, you go squish now!
-Homer Simpson

Registered linux user #287718
Post Reply