-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.aspx.cs
38 lines (36 loc) · 1.42 KB
/
contact.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class contact : System.Web.UI.Page
{
protected void BookNow_Click(object sender, EventArgs e)
{
using (var client = new SmtpClient("smtp.gmail.com", 587))
{
try
{
if (string.IsNullOrEmpty(SpamCheck.Text))
{
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("[email protected]", "Tr33$9791");
var mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Book Now Request From Maya McMahon Photography Website";
mail.Body = "Name: " + Name.Text + "\n";
mail.Body += "Email: " + Email.Text + "\n";
mail.Body += "Comment: " + Comment.Text + "\n";
client.Send(mail);
Response.Write("<script>alert('Thanks for your interest in Maya McMahon Photography. Maya will be in touch with you soon.');</script>");
}
}
catch (Exception ex)
{
}
}
}
}