using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net.Mail; using System.Text; public partial class ArEnquiry : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Button1.Attributes.Add("onmouseover", "this.style.backgroundColor ='#e38788';this.style.cursor='pointer'"); Button1.Attributes.Add("onmouseover", "this.style.color ='#000000';this.style.cursor='pointer'"); Button1.Attributes.Add("onmouseout", "this.style.color='#ffffff'"); //HyperLink1.Attributes.Add("onmouseover", "this.style.color ='#886600';this.style.cursor='pointer'"); //HyperLink1.Attributes.Add("onmouseout", "this.style.color ='#cc9900'"); //HyperLink2.Attributes.Add("onmouseover", "this.style.color ='#886600';this.style.cursor='pointer'"); //HyperLink2.Attributes.Add("onmouseout", "this.style.color ='#cc9900'"); Button2.Attributes.Add("onmouseover", "this.style.color ='#999999';this.style.cursor='pointer'"); Button2.Attributes.Add("onmouseout", "this.style.color='#ffffff'"); Button4.Attributes.Add("onmouseover", "this.style.color ='#000000';this.style.cursor='pointer'"); Button4.Attributes.Add("onmouseout", "this.style.color='#ffffff'"); Button3.Attributes.Add("onmouseover", "this.style.color ='#999999';this.style.cursor='pointer'"); Button3.Attributes.Add("onmouseout", "this.style.color='#ffffff'"); Button5.Attributes.Add("onmouseover", "this.style.color ='#000000';this.style.cursor='pointer'"); Button5.Attributes.Add("onmouseout", "this.style.color='#ffffff'"); Button6.Attributes.Add("onmouseover", "this.style.color ='#000000';this.style.cursor='pointer'"); Button6.Attributes.Add("onmouseout", "this.style.color='#ffffff'"); Button7.Attributes.Add("onmouseover", "this.style.cursor='pointer'"); } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("arHHome.aspx"); } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("arAboutUs.aspx"); } protected void Button3_Click(object sender, EventArgs e) { } protected void Button4_Click(object sender, EventArgs e) { Response.Redirect("arAgencies.aspx"); } protected void Button5_Click(object sender, EventArgs e) { Response.Redirect("ArSocio.aspx"); } protected void Button6_Click(object sender, EventArgs e) { Response.Redirect("ArEnquiry.aspx"); } protected void Button7_Click(object sender, EventArgs e) { if (TextBox1.Text == "" | TextBox2.Text == "" | TextBox3.Text == "" | TextBox4.Text == "" | TextBox5.Text == "") { Label1.Text = "Please fill in all fields"; } else { //string Message = "New Message from " + TextBox1.Text +". The company Email is " + TextBox2.Text + ". The company's Telephone number is " + TextBox3.Text + ".

Subject: " + TextBox5.Text + "
Message: " + TextBox4.Text + ""; StringBuilder Message = new StringBuilder(); Message.AppendFormat("New Message from: " + TextBox1.Text); Message.AppendLine(); Message.AppendFormat("Company Email:" + TextBox2.Text ); Message.AppendLine(); Message.Append("Company's Telephone number: " + TextBox3.Text); Message.AppendLine(); Message.Append("Subject: " + TextBox5.Text); Message.AppendLine(); Message.Append("Message:"); Message.AppendLine(); Message.Append (TextBox4.Text); Message.AppendLine(); StringBuilder coloursordered = new StringBuilder(); coloursordered.Append("Colors Selected: "); if (txtBGColor.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor.Text); } if (txtBGColor0.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor0.Text); } if (txtBGColor1.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor1.Text); } if (txtBGColor2.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor2.Text); } if (txtBGColor3.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor3.Text); } if (txtBGColor4.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor4.Text); } if (txtBGColor5.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor5.Text); } if (txtBGColor6.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor6.Text); } if (txtBGColor7.BackColor == System.Drawing.Color.White) { coloursordered.AppendLine(); coloursordered.Append("Color Code: #" + txtBGColor7.Text); } //try //{ Message.Append(coloursordered.ToString()); string kkll = "Message From Website"; MailMessage kol = new MailMessage(); kol.From = (new MailAddress("aragenccy@gmail.com", "ArAgenciesWebsite")); kol.To.Add(new MailAddress("arh786@mweb.co.za")); kol.Subject = kkll.ToString(); kol.Body = Message.ToString(); // kol.IsBodyHtml = true; kol.Priority = MailPriority.Normal; System.Net.NetworkCredential myCred = new System.Net.NetworkCredential("aragenccy@gmail.com", "P@ssword123"); SmtpClient sendit = new SmtpClient("smtp.gmail.com", 25); sendit.DeliveryMethod = SmtpDeliveryMethod.Network; sendit.UseDefaultCredentials = false; sendit.Credentials = myCred; sendit.EnableSsl = true; sendit.Send(kol); sendit.Timeout = 20000; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; Label1.Text = "Message successfully Sent, We will get back to you shortly"; // } //catch (Exception ex) //{ // Label1.Text = "Message Server down Please Contact Us Directly with any of the numbers above"; //} } } }