Friday, May 21, 2010
Configuring Mail Settings

Q. Can you tell me in which component, file, etc is it that I configure the mail host that should be used to send out the password reminders.

A.

You can configure mail settings of your application as follows:

  1. Run Code OnTime Generator and select your project.
  2. Click Next button a few times until your reach Web Server page in the project wizard.
  3. Paste the text from the sample below into Web.Config modification instructions field. Make sure to use your own SMTP server settings as values.
  4. Generate your project. The section system.net will be integrated into Web.Config file of your project whenever you generate the project next time.

InsertAfter: /configuration/connectionStrings
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="ben@contoso.com">
        <network
          host="localhost"
          port="25"
          defaultCredentials="true"
        />
      </smtp>
    </mailSettings>
  </system.net>

Note that InsertAfter instruction will insert the XML snippet just after the connectionStrings section in Web.Config configuration file of your application.

You can learn more about configuring mailSettings at http://msdn.microsoft.com/en-us/library/w355a94k.aspx.