3 Replies - 981 Views - Last Post: 26 April 2010 - 01:49 PM Rate Topic: -----

#1 MrWobbles  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 31
  • View blog
  • Posts: 328
  • Joined: 11-April 08

Email Contact Form

Posted 26 April 2010 - 01:04 PM

Alright, so I have this contact form and everything shows up just fine, and it acts like it sends email, but I am not recieving anything... I am not sure what is going on - so help is appreciated. Here is my code:

<%@ Control Language="C#" AutoEventWireup="true" %>

<%@ Import Namespace="System.Net.Mail" %>

<script runat="server">
    
    protected void SendMail(Object sender, EventArgs e)
    {
        MailMessage mail = new MailMessage();
        mail.From = new MailAddress("valid@emailAddress.com");
        mail.To.Add(tbEmail.Text.ToString);
        mail.Subject = tbSubject.Text.ToString;
        mail.IsBodyHtml = true;

        mail.Body = "Name: " + tbName.Text.ToString + "<br />";
        mail.Body += "Operating System: " + OSDropDown.Text.ToString + "<br />";
        mail.Body += "Application Name: " + appDropDown.Text.ToString + "<br />";
        mail.Body += "Question/Comment: <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + tbBody.Text.ToString + "<br />";

        SmtpClient smtp = new SmtpClient();
        smtp.Host = ;
        smtp.Send(mail);

    }

    protected void Reset(object s, EventArgs e)
    {
        
    }
</script>

    <FormTemplate>
        <div>
        <div class="field-list-header"></div>
                <fieldset class="field-list">
                   <ul class="field-list">
                        <li class="field-item">
                            <CSControl:FormLabel Id="name" runat="server" ResourceName="Weblog_ContactForm_Name" 
                                                     LabelCssClass="field-item-header" />
                            <span class="field-item-input"><asp:TextBox id="tbName" runat="server" 
                                            Columns="50" /></span>
                        </li>
                        <li class="field-item">
                            <CSControl:FormLabel Id="email" runat="server" ResourceName="Weblog_ContactForm_Email" 
                                                                    LabelCssClass="field-item-header" />
                            <span class="field-item-input"><asp:TextBox id="tbEmail" runat="server" 
                                                  Columns="50" /></span>
                       </li>
                        <li class="field-item">
                            <CSControl:FormLabel Id="subject" runat="server" 
                                  ResourceName="Weblog_ContactForm_Subject" LabelCssClass="field-item-header" />
                            <span class="field-item-input"><asp:TextBox id="tbSubject" runat="server" 
                                                                      Columns="50" /></span>
                       </li>
                        <li class="field-item">
                        <CSControl:FormLabel Id="osname" runat="server" 
                        ResourceName="Weblog_ContactForm_OperatingSystem" LabelCssClass="field-item-header" />
                            <span class="field-item-input">
                           <asp:DropDownList ID="OSDropDown" runat="server">
                                <asp:ListItem Value="invalid">----Select One----</asp:ListItem>
                                <asp:ListItem Value="Win7(32)">Windows 7 32-Bit</asp:ListItem>
                                <asp:ListItem Value="Win7(64)">Windows 7 64-Bit</asp:ListItem>
                                <asp:ListItem Value="WinVista(32)">Windows Vista 32-Bit</asp:ListItem>
                                <asp:ListItem Value="WinVista(64)">Windows Vista 64-Bit</asp:ListItem>
                                <asp:ListItem Value="WinXP(32)">Windows XP 32-Bit</asp:ListItem>
                                <asp:ListItem Value="WinXP(64)">Windows XP 64-Bit</asp:ListItem>
                           </asp:DropDownList></span>
                            </li>
                        <li class="field-item">
                        <CSControl:FormLabel Id="appname" runat="server" 
                            ResourceName="Weblog_ContactForm_ApplicationName" LabelCssClass="field-item-header" />
                            <span class="field-item-input">
                           <asp:DropDownList ID="appDropDown" runat="server">
                                <asp:ListItem Value="invalid">----Select One----</asp:ListItem>
                                <asp:ListItem Value="DIYDeck">Deck Designer (Do-It-Yourself)</asp:ListItem>
                                <asp:ListItem Value="DIYFence">Fence Designer (Do-It-Yourself)</asp:ListItem>
                                <asp:ListItem Value="DIYGarage">Garage Designer (Do-It-Yourself)</asp:ListItem>
                                <asp:ListItem Value="DIYPost">Post Frame Designer (Professional)</asp:ListItem>
                                <asp:ListItem Value="ProDeck">Deck Designer (Professional)</asp:ListItem>
                                <asp:ListItem Value="ProFence">Fence Designer (Professional)</asp:ListItem>
                                <asp:ListItem Value="ProGarage">Garage Designer (Professional)</asp:ListItem>
                                <asp:ListItem Value="ProPost">Post Frame Designer (Professional)</asp:ListItem>
                           </asp:DropDownList></span>
                          </li>
                        <li class="field-item">
                            <CSControl:FormLabel Id="body" runat="server" ResourceName="Weblog_ContactForm_Body" 
                                                       LabelCssClass="field-item-header" />
                            <span class="field-item-input"><asp:TextBox id="tbBody" runat="server" 
                                                       TextMode="MultiLine" Columns="50" Rows="8" /></span>
                        </li>
                        <li class="field-item">
                           <span class="field-item-input">
						       <asp:LinkButton ID="btnSubmit" runat="server"  
                                                        CssClass="internal-link send-
                                                         email"><span></span><CSControl:ResourceControl 
                                                         ID="ResourceControl1" runat="server" 
                                                          ResourceName="Send" /></asp:LinkButton>
                            </span>
                        </li>
                    </ul>
                </fieldset>
                <div class="field-list-footer"></div>
        </div>
    </FormTemplate>



Is This A Good Question/Topic? 0
  • +

Replies To: Email Contact Form

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Email Contact Form

Posted 26 April 2010 - 01:18 PM

Is your host setup as an SMTP mail server?
Was This Post Helpful? 1
  • +
  • -

#3 MrWobbles  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 31
  • View blog
  • Posts: 328
  • Joined: 11-April 08

Re: Email Contact Form

Posted 26 April 2010 - 01:37 PM

Yes, it is.
Was This Post Helpful? 0
  • +
  • -

#4 MrWobbles  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 31
  • View blog
  • Posts: 328
  • Joined: 11-April 08

Re: Email Contact Form

Posted 26 April 2010 - 01:49 PM

Nevermind, I got it - I was stupidly uploading the wrong file.... thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1