SMTP Relay via MS Exchange

authenticationexchangentlmsmtp

I am trying to pragmatically send e-mail to external user with Exchange.

Now I know if Relay is not Enabled in Exchange Server then e-mail relay will not work.

Now, if I send e-mail from my Outlook I can send e-mails to, say, hotmail.

But when I am trying to send the same e-mail via manually connecting to port 25 (SMTP) it says

550 5.7.1 Unable to relay for dork@hotmail.com

I have made sure I am authenticated before trying to send the e-mail. This is what I did:

Trying 10.10.50.164...
Connected to kamail.roshan.af (10.10.50.164).
Escape character is '^]'.
220 foo.bar.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at  Wed, 3 Oct 2012 22:16:50 +0430 
EHLO RADB
250-foo.bar.com Hello [10.10.50.53]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
AUTH LOGIN
334 VXNlcm5hbWU6
Zm9vQGJhci5jb20=
334 UGFzc3dvcmQ6
aGVsbG8=
235 2.7.0 Authentication successful.
MAIL FROM: foo@bar.com
250 2.1.0 foo@bar.com....Sender OK
RCPT TO: dork@hotmail.com
550 5.7.1 Unable to relay for dork@hotmail.com
QUIT

I am wondering, what am I doing wrong! And how does Outlook send the e-mail with the recipient. I even tried to login to IMAP when trying to send mail with SMTP

Some insight about the above would be very helpful.

Best Answer

Having a valid mailbox on the Exchange server does not guarantee you'll be able to send messages to esternal recipients using SMTP; this depends on the Exchange configuration, which may very well be configured to not allow SMTP relay, regardless of authentication. Exchange treats MAPI clients (Outlook) and SMTP clients as two completely different things, and can give different permissions to them, even if they use the same user account and Exchange mailbox.

You should ask the Exchange administrator to have a look into this issue.