Web.config SMTP Email Setting

Discussion in 'ASP.NET 2.0' started by usadentalnetwork, Aug 11, 2006.

  1. Code:
    <configuration>
      <!-- Add the email settings to the <system.net> element -->
    [B]  <system.net>
        <mailSettings>
          <smtp>
            <network 
                 host="[I]relayServerHostname[/I]" 
                 port="[I]portNumber[/I]"
                 userName="[I]username[/I]"
                 password="[I]password[/I]" />
          </smtp>
        </mailSettings>
      </system.net>[/B]
    
      <system.web>
        ...
      </system.web>
    </configuration>
    

    The
    Code:
    host
    attribute contains the relayServerHostname. If you are using an external relay server, the relayServerHostname might be something like
    Code:
    smtp.yourisp.com
    . If the relay server's port number is something other than the typical port 25, specify it through the
    Code:
    port
    attribute. Most external relay servers require authentication of some sort (in order to prevent anonymous spammers from sending their garbage through the relay). The
    Code:
    userName
    and
    Code:
    password
    attributes can be provided in the case where username/password authentication is needed.


    My site is hosted with discountASP.net, all I know for sure is the name of "host" is "smtp.mydomainname.com". However, what is the other values I should put in the above setting? - Port, userName and passWord?


    Any help is appreciated!
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    Try this

    <mailSettings>
    <smtp>
    <network
    host="localhost"
    port="25"
    userName=""
    password="" />
    </smtp>
    </mailSettings>


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page