Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2008
    Posts
    49

    Unanswered: anybody know how to use a mail to button in asp.net

    hi i have created a contact us form is visual studio 2005, when i use a mail to button for the submitt butoon i keep getting errors when running the page

    here is my table were will the code go and what is it:

    <table style="width: 40%; position: static" bgcolor="#000000">
    <tr>
    <td style="width: 100px; height: 9px; background-color: silver; vertical-align: top; text-align: left;">
    Name</td>
    <td style="width: 100px; height: 9px; vertical-align: top; background-color: silver; text-align: left;">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
    </tr>
    <tr>
    <td style="width: 100px; background-color: silver; vertical-align: top; text-align: left;">
    Email</td>
    <td style="width: 100px; vertical-align: top; background-color: silver; text-align: left;" bgcolor="#000000">
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
    </tr>
    <tr>
    <td style="vertical-align: top; width: 100px; background-color: silver; text-align: left; height: 99px;">
    Message</td>
    <td style="width: 100px; vertical-align: top; height: 99px; background-color: silver; text-align: left;">
    <asp:TextBox ID="TextBox3" runat="server" Height="97px" Width="349px"></asp:TextBox></td>
    </tr>
    <tr>
    <td style="vertical-align: top; width: 100px; height: 21px; background-color: silver;
    text-align: left">
    </td>
    <td style="vertical-align: top; width: 100px; height: 21px; background-color: silver;
    text-align: left">
    <asp:Button ID="Button1" runat="server" Text="Submit" /></td>


    <a href="mailto:myemail@hotmail.com">Submit</a>
    i treid the following code but dont work

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Generally speaking a contact us form works in two ways.

    1) using the anchor tag with a href attribute containing mailto:
    This will open up a fresh little email with the information you specify as mailto attributes, but does not send it.

    2) you fill in a form which is submitted, but contrary to popular belief, this does not send an email! This instead inserts the data into a database. The data can then be read by the people you are contacting, or indeed with ceertain DBMS a trigger event can fire which sends an email containing the stored details.

    Hope this helps; feel free to ask questions as always
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2008
    Posts
    49
    so do u know the code please?

    the code ive specified above does not work

  4. #4
    Join Date
    Feb 2008
    Posts
    49
    also would you know of a valid validation rule or emaill address

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Regular expressions are the best way of validating email addresses (www.regexlib.com).

    You already know the code for number 1, but there is a more detailed example here.

    The second option involves you submitting and storing the data in a database; if memory serves you can already do this!

    What DBMS are you using as the back end?

    Ask yourself; is it really imperative for an email to be sent instead of you checking the submissions from the db?
    George
    Home | Blog

  6. #6
    Join Date
    Dec 2007
    Posts
    21
    dont they teach CSS around here? code looks awfull

    Code:
    <form method=post action=mailto:mail@server.com>
    ....
    <input type=submit>
    </form>
    Last edited by noamsmadja; 05-06-08 at 11:08.

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by noamsmadja
    dont they teach CSS around here? code looks awfull

    Code:
    <form method=post action=mailto:mail@server.com>
    ....
    <input type=submit>
    </form>
    That's not going to work in asp.net. It's going to yell at you about having an invalid page when you go to postback. You can't have another form inside your "main" form that's been tagged with runat="server".
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •