Wednesday, February 23, 2011

Outlook 2010 talking to Exchange 2000 via SMTP.

After some requests in my personal e-mail, I've decided to explain here the steps needed to make Outlook 2010 work with an SMTP Exchange 2000 server.
(Sorry my english, as is not my natural language)

The case goes back to January, when I needed to configure Outlook 2010 to work with the company's server that is based in a different country. This is a little important detail, as the foreign IT department wouldn't be any helpfull. The server was an Exchange 2000 but all the clients are working via SMTP and POP.
If you need to connect O2010 to Exchange 2000 using Exchange's protocol, please stop reading right here.
So, I knew that e-mails could be received, but by all the means, they just won't go out.
I grabbed a copy of Wireshark and started to analyse what's wrong in here.
Long story short:
...the server tells the client what authentication protocols it supports, however Outlook 2010 wants to use DIGEST-MD5.
This is the main difference between Outlook Express (which works great) and Outlook 2010:

Outlook Express:
HELO machine
AUTH LOGIN
username base64 encoded
password base64 encoded
mails go through.
Outlook 2010:
HELO machine
AUTH DIGEST-MD5
response from server
Outlook sends just a *
AUTH LOGIN
password base64 encoded

And it stops right here, no auth, no e-mails to the outside world :)
So, if this is just a little glitch in the matrix, we'll fix it with a python script.
This script, is just a bad re-writen code of a transparent proxy, we're you can mess around with the messages sent between server<->client.
My biggest thanks go to:
Dirk Holtwick (INI reader)
Lobsang (Python Proxy) @ ActiveState
They sure saved me a lot of work by not re-inventing the wheel myself.
So this is the script:

(Update: Removed code, use github link instead)
https://github.com/yaba/SMTPProxy

Sorry, some pieces are in Portuguese, but the code is self-explanatory.
In the config file, you have 2 sections, on srv2clt it processes all the messages from server to client and changes what is need to make Exchange 2000 work with Outlook 2010 (Auth strings)
The clt2srv isn't really needed, but, while I was at it, I thought this could come in handy sometime.
So... now, you have to run the script at localhost or any other server, and tell Outlook to use THAT server as the SMTP server, also, change the config.ini to meet your real SMTP server.
I've also added the port option, just in case.
My costumer uses only windows machines *sigh*, so I've converted python script to a Windows executable and used a tutorial (easy to find online) to make it work like a windows service.
If you have any questions or it doesn't work out for you, just send a e-mail or comment, I'll try to help as soon as possible.

6 comments:

  1. Hi,
    Thanks for sharing. I try compile your script on http://codepad.org but its says many errors, how can I get compiled file, I'm not programmer. Thanks.

    ReplyDelete
    Replies
    1. Hi.
      I will add an download link to the original script, the spaces/tabs in this post are wrong. Sorry.

      Delete
    2. Thanks for answer, I'm still waiting :)

      Delete
  2. Olá Sr. Filipe.
    Só por curiosidade, tem familiares na Marinha Grande?
    É que tive um colega cujas iniciais são J.M.G.Polido (salvo erro)

    Daqui:
    Artur
    artmorarrobagmail.com

    ReplyDelete
    Replies
    1. Que eu tenha conhecimento, não. Mas eles andam por aí :)

      Delete
  3. @Hingel
    Did I sent you the code back then? If not, I'm so sorry, and please use Github instead. Thanks

    ReplyDelete