The MailDefinition class uses the email server configured by the smtp element in the web configuration file. : Email « Development « ASP.NET Tutorial






File: Web.Config

<configuration>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="PickupDirectoryFromIis"/>
    </mailSettings>
  </system.net>
  <system.web>
    <authentication mode="Forms" />
  </system.web>
</configuration>


To connect to a mail server located on another machine

File: Web.Config

<configuration>
  <system.net>
    <mailSettings>
      <smtp>
        <network
            host="mail.YourServer.com"
            userName="admin"
            password="secret" />
      </smtp>
    </mailSettings>
  </system.net>
  <system.web>
    <authentication mode="Forms" />
  </system.web>
</configuration>








9.14.Email
9.14.1.Send email from your page (C#)
9.14.2.Sending mail from a Web page (VB)
9.14.3.Sending mail from a Web page (C#)
9.14.4.Send an email out (VB.net)
9.14.5.The MailDefinition class uses the email server configured by the smtp element in the web configuration file.