i have created a contact me form . i have two questions
1. when the user hits submit how do i ge the page to refresh without displaying the data they had entered . "also i may add in the last line of code it shows the user the email was sent" would this still display if i rerech the page withought the data....
2. with the code i have how do i send a reply to the user saying thank you your request has been sent someone willl respond shortly....... something on those lines...
for #1 you on your button click, after the submission if finished just set all textbox values equal to "" That will make them all blank, then after all that happens show a div that has "Email Sent" that is initially hidden with divname.style("display") =
"block" or do label.Text = "Email Sent" if you want to use a blank label.
#2 You can send an email in code behind with this (VB.NET)
'Send Email confirming Receipt.
Dim objMM As New MailMessage()
'Set the properties - send the email to the person who filled out the feedback form.
objMM.To.Add(New MailAddress(SenderEmail))
objMM.Bcc.Add(New MailAddress("aa@bb.com"))
objMM.From = New MailAddress("aa@bb.com")
'Send the email in text format
objMM.IsBodyHtml = True
'Set the subject
objMM.Subject = "Email Subject"
'Set the body
objMM.Body = "Thank you for submitting. This email is to confirm that everything has been received"
objMM.Priority = MailPriority.Normal
'Specify to use the default Smtp Server
Dim mSmtpClient As New SmtpClient
mSmtpClient.Host = "someip"
mSmtpClient.Send(objMM)
I dont have it in C# but using a converter it came up with this (May not be 100% accurate)
MailMessage objMM = new MailMessage();
//Set the properties - send the email to the person who filled out the feedback form.
objMM.To.Add(new MailAddress(SenderEmail));
objMM.Bcc.Add(new MailAddress("aa@bb.com"));
objMM.From = new MailAddress("aa@bb.com");
//Send the email in text format
objMM.IsBodyHtml = true;
//Set the subject
objMM.Subject = "Email Subject";
//Set the body
objMM.Body = "Thank you for submitting. This email is to confirm that everything has been received";
objMM.Priority = MailPriority.Normal;
//Specify to use the default Smtp Server
SmtpClient mSmtpClient = new SmtpClient();
mSmtpClient.Host = "someip";
mSmtpClient.Send(objMM);
thelongislan...
Member
97 Points
83 Posts
contact form email question
Mar 01, 2012 03:30 PM|LINK
i have created a contact me form . i have two questions
1. when the user hits submit how do i ge the page to refresh without displaying the data they had entered . "also i may add in the last line of code it shows the user the email was sent" would this still display if i rerech the page withought the data....
2. with the code i have how do i send a reply to the user saying thank you your request has been sent someone willl respond shortly....... something on those lines...
thanks in advance for your help.
DarthSwian
Star
12771 Points
2361 Posts
Re: contact form email question
Mar 01, 2012 03:35 PM|LINK
clearing the form is a simple mater of doing
txtUserName.text = string.empty;
in your processing function for all fields to clear.
You can have a function to send the email and have it retrun a boolean value with pass fail to determine to show a success message.
Take a look at this for sending email
http://forums.asp.net/t/971802.aspx
Seek and ye shall find or http://lmgtfy.com/
ramiramilu
All-Star
95503 Points
14106 Posts
Re: contact form email question
Mar 01, 2012 03:39 PM|LINK
this is what you want - http://www.intstrings.com/ramivemula/asp-net/ajax-html-editor-based-contact-form-inside-updatepanel-along-with-updateprogress/
thanks,
JumpStart
Wozer
Member
390 Points
267 Posts
Re: contact form email question
Mar 01, 2012 03:40 PM|LINK
for #1 you on your button click, after the submission if finished just set all textbox values equal to "" That will make them all blank, then after all that happens show a div that has "Email Sent" that is initially hidden with divname.style("display") = "block" or do label.Text = "Email Sent" if you want to use a blank label.
#2 You can send an email in code behind with this (VB.NET)
'Send Email confirming Receipt. Dim objMM As New MailMessage() 'Set the properties - send the email to the person who filled out the feedback form. objMM.To.Add(New MailAddress(SenderEmail)) objMM.Bcc.Add(New MailAddress("aa@bb.com")) objMM.From = New MailAddress("aa@bb.com") 'Send the email in text format objMM.IsBodyHtml = True 'Set the subject objMM.Subject = "Email Subject" 'Set the body objMM.Body = "Thank you for submitting. This email is to confirm that everything has been received" objMM.Priority = MailPriority.Normal 'Specify to use the default Smtp Server Dim mSmtpClient As New SmtpClient mSmtpClient.Host = "someip" mSmtpClient.Send(objMM)thelongislan...
Member
97 Points
83 Posts
Re: contact form email question
Mar 01, 2012 03:51 PM|LINK
TY Very much!!!! can you send that code in c#?
Wozer
Member
390 Points
267 Posts
Re: contact form email question
Mar 01, 2012 03:53 PM|LINK
I dont have it in C# but using a converter it came up with this (May not be 100% accurate)
MailMessage objMM = new MailMessage(); //Set the properties - send the email to the person who filled out the feedback form. objMM.To.Add(new MailAddress(SenderEmail)); objMM.Bcc.Add(new MailAddress("aa@bb.com")); objMM.From = new MailAddress("aa@bb.com"); //Send the email in text format objMM.IsBodyHtml = true; //Set the subject objMM.Subject = "Email Subject"; //Set the body objMM.Body = "Thank you for submitting. This email is to confirm that everything has been received"; objMM.Priority = MailPriority.Normal; //Specify to use the default Smtp Server SmtpClient mSmtpClient = new SmtpClient(); mSmtpClient.Host = "someip"; mSmtpClient.Send(objMM);thelongislan...
Member
97 Points
83 Posts
Re: contact form email question
Mar 01, 2012 03:56 PM|LINK
ty all this is all very helpful