Posting data from Email to ASP.NET Page
-
try this MailMessage objEmail = new MailMessage(); objEmail.To = txtTo.Text; objEmail.From = txtFrom.Text; objEmail.Cc = txtCc.Text; objEmail.Subject = "Test Email"; objEmail.Body = txtName.Text + ", " + txtComments.Text; objEmail.Priority = MailPriority.High; //SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(objEmail); Response.Write("Your Email has been sent sucessfully - Thank You"); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString()); }
-
try this MailMessage objEmail = new MailMessage(); objEmail.To = txtTo.Text; objEmail.From = txtFrom.Text; objEmail.Cc = txtCc.Text; objEmail.Subject = "Test Email"; objEmail.Body = txtName.Text + ", " + txtComments.Text; objEmail.Priority = MailPriority.High; //SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(objEmail); Response.Write("Your Email has been sent sucessfully - Thank You"); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString()); }
My question is different. I know how to send email. Actually email is send to the user. The body of the mail contains the HTML tages that forms the complete html page. Now I want to post the information from that HTML page to ASP.Net page.
Ashwani
-
Hi Make the action attribute of your form to your aspx page. Change method to get. And in ASPX page get these values using
Request.QueryString
method. But I am not sure that this will work because, usually email providers won't allow any executable scripts on the body. That will cause severe security problems. Some providers may spam this type of messages. Tell me on what scenario you need to do like this ? Instead of doing this you can send a link where users can do the same. Happy ProgrammingNavaneeth My Website