How to configure mailSettings in web.config to authenticate with SMTP servers

Oct 29, 2008 at 12:24 PM
Edited Nov 8, 2008 at 2:56 PM
Many users seem to struggle configuring mailSettings in web.config to authenticate with SMTP servers, especially MS Exchange.

First, I recommend reading or any documentation regarding the System.Net.Mail classes which are used to send email notifications.

We have provided the SMTP Test Utility to make it easier for you to test your SMTP connection. You can also consider using an SMTP proxy to visualize the commands sent by Velodoc XP Edition or the SMTP Test Utility to your mail server via System.Net.Mail. Another tool which I have found helpful is the Microsoft SMTPDiag Tool.

You basically have 3 authentication scenarios: Basic Autentication, TLS and Windows Integrated Authentication. The mailSettings/smtp/network element in web.config misses an enableSsl attribute to configure TLS but we have implemented a workaround constituted of a key named EnableTLS in appSettings.

Now configuring web.config in Velodoc XP Edition gives you two options:
<network host="localhost" port="25" defaultCredentials="true"/>
<network host="localhost" port="25" userName="xxx" password="yyy"/>
  1. to use defaultCredentials = true or Windows Integrated Authentication, you may have to configure the Velodoc XP web application in IIS to run as a dedicated application pool under the identity of an NT user corresponding to the mailbox that sends the email notifications, especially for Exchange. We have a document which explains this in details with screenshots for Exchange 2007 and which you can request by posting a comment here. Note that this is the Microsoft "preferred" way but your SMTP server should support Windows Integrated Authentication.
  2. using userName and password requires that your mail server supports basic authentication or TLS (using the workaround described above). Note that some SMTP servers require an email adress as the user name (username@domain.tld), other SMTP servers just require the user name portion of the email address (username) and Exchange and IIS SMTP server require an NT user name (domain\username).
Jun 22, 2009 at 5:24 PM

Should you send me the document for Exchange 2007?

Best regards,

Fernando Carrasco