Hey everyone - Im new here. I appreciate any and all help you guys can provide! this is driving me crazy, and I am still wet behind the ears when it comes to asp.net.
I have 2 pages, index.aspx and downloads.aspx. There is a form on index.aspx that on submit server.transfer users to downloads.aspx (so i can use the form data from the downloads.aspx page) From downloads.aspx there are a number of download links that once one is clicked, I want the page to compose an email of the data from the form on index.aspx, as well as the product demo the user is downloading and then send it. I am having some major issue with this, and it seems like a very simple concept...Can anyone offer any suggestions?
<%@ Page Language="C#" EnableViewStateMac="False" Debug="true"%>
<%@ import Namespace="System" %>
<% @Import Namespace="System.Web.Mail" %>
<SCRIPT Runat="Server">
public void Page_Load(object sender, System.EventArgs e)
{
transName.Text = Request.Form["tbxName"];
transCompany.Text = Request.Form["tbxCompany"];
transPhone.Text = Request.Form["tbxPhone"];
transEmail.Text = Request.Form["tbxEmail"];
}
public void Button1_Click(object sender, EventArgs e) {
if(Session["submitted"] == "false") {
Mailit();
}
}
public void Mailit() {
MailMessage msgMail = new MailMessage();
msgMail.To = "MY ADDRESS";
msgMail.Cc = "";
msgMail.Bcc = "";
msgMail.From = "test";
msgMail.Subject = "Product Download Customer Information";
msgMail.BodyFormat = MailFormat.Html;
string strBody = "<html><body><h2>Customer Information Collection</h2><p>The following data was acquired from a user accessing product downloads</p><table border='1'>"
+ "<tr><td><strong>Sent: </strong></td><td>" + DateTime.Now.ToString("ddd MMM dd yyyy / hh:mm")
+ "<tr><td><strong>Name: </strong></td><td>" + transName.Text + "</td></tr>"
+ "<tr><td><strong>Company: </strong></td><td>" + Request.Form["tbxCompany"] + "</td></tr>"
+ "<tr><td><strong>Phone: </strong></td><td>" + Request.Form["tbxPhone"] + "</td></tr>"
+ "<tr><td><strong>Email: </strong></td><td>" + Request.Form["tbxEmail"] + "</td></tr>"
+ "</table></body></html>";
msgMail.Body = strBody;
SmtpMail.Send(msgMail);
Session["submitted"] = "true";
this.Response.Redirect("downloads.aspx");
}
</SCRIPT>
--][--