using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; public partial class bridgingform : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void cmdSend_Click(object sender, EventArgs e) { SendEmail(); } private void SendEmail() { SmtpClient oClient; MailMessage oMessage; String ToSend; //Make the message ToSend = "A bridging loan enquiry has been made from trueblueadvisors.co.uk\n\n"; ToSend = ToSend + "Firstname: " + this.txtFirstName.Text; ToSend = ToSend + "\nSurname: " + this.txtSurname.Text; ToSend = ToSend + "\nDate of Birth: " + this.txtDOB.Text; ToSend = ToSend + "\nTelephone: " + this.txtTelphone.Text; ToSend = ToSend + "\nAlt Telephone: " + this.txtAltTelephone.Text; ToSend = ToSend + "\nEmail Address: " + this.txtEmailAddress.Text; ToSend = ToSend + "\nAddress: " + this.txtAddressLine1.Text + ", " + this.txtAddressLine2.Text + ", " + this.txtAddressLine3.Text + ", " + this.txtAddressLine4.Text + ", " + this.txtAddressLine5.Text; ToSend = ToSend + "\n\n\n"; ToSend = ToSend + "Purchase Price: " + this.txtPurchasePrice.Text; ToSend = ToSend + "\nBriding Loan Required: " + this.txtBridingAmount.Text; ToSend = ToSend + "\nMin Loan Period: " + this.txtLoanPeriod.Text; ToSend = ToSend + "\nValue of Property Secured on: " + this.txtPropertyValue.Text; ToSend = ToSend + "\nAmount of Existing Mortgage: " + this.txtExistingMortgageAmount.Text; ToSend = ToSend + "\nOther Information: " + this.txtOtherInfo.Text; //Initialise the mail client oClient = new SmtpClient("localhost", 25); oMessage = new MailMessage("websitecontact@trueblueadvisors.co.uk", "daniel@trueblueadvisors.co.uk", "Briding Loan Enquiry", ToSend); oMessage.IsBodyHtml = false; //Now try and send try { oClient.Send(oMessage); this.lblError.Text = "Your message has been sent!"; this.lblError.Visible = true; this.imgBridgingFormRelTraf.Visible = true; } catch (Exception) { this.lblError.Text = "Your message could not be sent, please call us"; this.lblError.Visible = true; } } }