Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i want to send email in asp.net .i have tryied ur code which i got in
the url Send Email in ASP.Net 2.0 - Feed back Form[^]

but it is not working.
i tryied to find a error by writing code as ex.InnerException.Message it was Unable to connect to the remote server
Posted

Look at this link

http://tinyurl.com/2daaay8[^]

Look how many there are, just look at those results!
 
Share this answer
 
Quick method:

You may need to put the server details in:
XML
<configuration>
  <!-- Add the email settings to the <system.net> element -->
  <system.net>
    <mailSettings>
      <smtp>
        <network
             host="relayServerHostname"
             port="portNumber"
             userName="username"
             password="password" />
      </smtp>
    </mailSettings>
  </system.net>
  <system.web>
    ...
  </system.web>
</configuration>




And then Create the form:
XML
<table border="0">
    <tr>
        <td><b>Your Email:</b></td>
        <td><asp:TextBox runat="server" ID="UsersEmail" Columns="30"></asp:TextBox></td>
    </tr>
    <tr>
        <td><b>Subject:</b></td>
        <td><asp:TextBox runat="server" ID="Subject" Columns="30"></asp:TextBox></td>
    </tr>
    <tr>
        <td colspan="2">
            <b>Body:</b><br />
            <asp:TextBox runat="server" ID="Body" TextMode="MultiLine" Columns="55" Rows="10"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td colspan="2" align="center">
            <asp:Button runat="server" ID="SendEmail" Text="Send Feedback" />
        </td>
    </tr>
</table>
 
Share this answer
 
Comments
software_Engi08 2-Sep-10 7:46am    
host="relayServerHostname"
port="portNumber"
userName="username"
password="password" />
what i should write in username and password atribute i have written in host="localhost"
port="25" is it right

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900