Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jo 5 posts 35 karma points
    Aug 11, 2013 @ 19:33
    Jo
    0

    Send email contact us page

    Hello,

    I know this issue has been addressed hundreds of times. I use a base template and in it i found a contact us form. I do some modification for my need :

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="~/App_Code/RunwayContactForm/Contact.ascx.cs" Inherits="RunwayContactForm.Contact" %>
    
    <asp:ValidationSummary id="valSum" runat="server" CssClass="error" DisplayMode="BulletList" />
    <ul>    
    <li> <asp:Label id="lb_name" runat="server" AssociatedControlID="tb_name" Text="Name" /> <asp:TextBox ID="tb_name" cssclass="text" runat="server" /> </li> <li> <asp:Label id="lb_email" runat="server" AssociatedControlID="tb_email" Text="Email" /> <asp:TextBox ID="tb_email" cssclass="text" runat="server" /> </li> <li> <asp:Label id="lb_phone" runat="server" AssociatedControlID="tb_phone" Text="Phone" /> <asp:TextBox ID="tb_phone" cssclass="text" runat="server" /> </li> <li> <asp:Label id="Label1" runat="server" AssociatedControlID="tb_msg" Text="Message" /> <asp:textbox ID="tb_msg" runat="server" cssclass="text" textmode="MultiLine"/> </li> <li> <asp:Button ID="bt_submit" OnClick="SendMail" runat="server" Text="SEND" CssClass="contactUsBtn"/> <asp:Label CssClass="success" id="lb_success" runat="server" Visible="false">SEND</asp:Label> </li> </ul> <asp:RequiredFieldValidator Display="None" ID="RequiredFieldValidator0" ControlToValidate="tb_name" runat="server" ErrorMessage="Name is mandatory" /> <asp:RequiredFieldValidator Display="None" ID="RequiredFieldValidator1" ControlToValidate="tb_email" runat="server" ErrorMessage="Email is mandatory" /> <asp:RequiredFieldValidator Display="None" ID="RequiredFieldValidator2" ControlToValidate="tb_msg" runat="server" ErrorMessage="Message is mandatory" /> <asp:RegularExpressionValidator Display="None" ID="RegularExpressionValidator0" runat="server" ValidationExpression="^(?i:(?<local_part>[a-z0-9!#$%^&*{}'`+=-_|/?]+(?:\.[a-z0-9!#$%^&*{}'`+=-_|/?]+)*)@(?<labels>[a-z0-9]+\z?.*[a-z0-9-_]+)*(?<tld>\.[a-z0-9]{2,}))$" ControlToValidate="tb_email" ErrorMessage="Email is not valid" />

    and

     using System;

    using umbraco;

    namespace RunwayContactForm {

    public partial class Contact : System.Web.UI.UserControl {

    private string subject;

    public string Subject {

    get { return subject; }

    set { subject = value; }

    }
    private string yourEmail;

    public string YourEmail {

    get { return yourEmail; }

    set { yourEmail = value; }

    }

    protected void Page_Load(object sender, EventArgs e) {

    }

    protected void SendMail(object sender, EventArgs e) {

    Page.Validate();

    if (Page.IsValid) {

    library.SendMail(tb_email.Text, yourEmail, subject, String.Format("Name : {0} \\n Phone : {1} \\n Message : {2}",tb_name.Text,tb_phone.Text,tb_msg.Text),true);

    bt_submit.Visible = false;

    lb_success.Visible = true;

    }

    }

    }

    }

    in my web.config :

     <system.net>

    <mailSettings>

    <smtp>

    <network host="smtp.gmail.com" port="587" defaultCredentials="false" userName="[email protected]" password="mypassword" enableSsl="true" />

    </smtp>

    </mailSettings>

    </system.net>

    I look for information on the web and found something but nothing work. My gmail got allways use protocole https and
    IMAP is activate, but my mail never send

     

    P.S.: I have a search bar to do and i see that quickseach exist in umbraco but i don't know how to use it someone can tell me.

     

    Thank you for the future replay and have a good day.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies