lunargirrl
Programmer
Hi 
I am using asp.net to send an inserted html e-mail by SmtpMail.
I use: Email.aspx - is my html page which contains some dynamic fields such as user id, username (everything included in the body of this page.
Main page:
...
Context.Items.Add("ID", dsSearch.Tables(0).Rows(0).Item(0))
Context.Items.Add("UserName", dstPesquisa.Tables(0).Rows(0).Item(1))
Dim objResponse As WebResponse
Dim objRequest As WebRequest=System.Net.HttpWebRequest.Create("Email.aspx")
objResponse = objRequest.GetResponse
Dim sr As New StreamReader(objResponse.GetResponseStream)
Dim strMessage As String = sr.ReadToEnd()
objMail.From = "me@myself.com"
objMail.To = "you@yourself.com"
objMail.Subject = "This is a test"
objMail.Body = strMessage
objMail.BodyFormat = MailFormat.Html
Try
SmtpMail.SmtpServer = "10.0.0.1"
SmtpMail.Send(objMail)
Catch err As Exception
Response.Write(SmtpMail.SmtpServer + err.Message)
End Try
Problems I found:
1) the sintax WebRequest=System.Net.HttpWebRequest.Create("Email.aspx") gives me the error "Invalid URI"
2) How can I bound the fields of Email.aspx to the variables (id, username) that I have in my main page?
Please someone could help me??
I tried, tried many times and had no sucess.
TIA,
Gisele
I am using asp.net to send an inserted html e-mail by SmtpMail.
I use: Email.aspx - is my html page which contains some dynamic fields such as user id, username (everything included in the body of this page.
Main page:
...
Context.Items.Add("ID", dsSearch.Tables(0).Rows(0).Item(0))
Context.Items.Add("UserName", dstPesquisa.Tables(0).Rows(0).Item(1))
Dim objResponse As WebResponse
Dim objRequest As WebRequest=System.Net.HttpWebRequest.Create("Email.aspx")
objResponse = objRequest.GetResponse
Dim sr As New StreamReader(objResponse.GetResponseStream)
Dim strMessage As String = sr.ReadToEnd()
objMail.From = "me@myself.com"
objMail.To = "you@yourself.com"
objMail.Subject = "This is a test"
objMail.Body = strMessage
objMail.BodyFormat = MailFormat.Html
Try
SmtpMail.SmtpServer = "10.0.0.1"
SmtpMail.Send(objMail)
Catch err As Exception
Response.Write(SmtpMail.SmtpServer + err.Message)
End Try
Problems I found:
1) the sintax WebRequest=System.Net.HttpWebRequest.Create("Email.aspx") gives me the error "Invalid URI"
2) How can I bound the fields of Email.aspx to the variables (id, username) that I have in my main page?
Please someone could help me??
I tried, tried many times and had no sucess.
TIA,
Gisele