views:

368

answers:

0

Hello,

I'm trying to make a C# application that sends email notifications, utilizing using the Microsoft SMTP server. The computer where both the SMTP and the C# app are is a Windows Server 2008 with IIS7.

It might be confusing to point out IIS7 in the topic since the new SMTP server comes as a feature of Windows Server 2008 and not IIS7. However, I'd like to know if IIS7's settings have any relevance to this matter.

The problem is that I have disabled the anonymous authentication and enabled only Windows authentication. However, the C# app can connect to the SMTP and send emails regardless of the login credentials that I pass to the server using SmtpClient.Credentials.

In the UI of IIS7 there is a configuration of a SMTP feature with some authentication options. However, from what I gather from MSDN, IIS.net and other sources, those authentication details are used in case you want to connect to an external SMTP server and it's just a convenience - just writing the SMTP server name and credentials in the web.config file of the given ASP site.

My question is: Is there a way to enforce authentication with the Microsoft SMTP server and if Windows authentication is the only way to go, why didn't it work in this case?

PS: If it's of any importance, I'm using the SmtpDeliveryMethod.PickupDirectoryFromIis option when trying to send the emails.