If myMailMessage.Body = "" Then
myMailMessage.Body = Label0.Text + Label2.Text
myMailMessage.IsBodyHtml = True
End If
btn_Send.Visible = False
' Retrieve HTML via HTTP request to use as body of email
Dim GetHttpWebPage_Obj As New GetHttpWebPage
myMailMessage.Body = GetHttpWebPage_Obj.returnWebContain("http://localhost:3486/Sample/EmailTemplate/StatusEmail.aspx?SupportStaffID=78")
but i got one problem,i can display the gridview for the SupportStaffID = "78" as shown on my URL in bold..but when i choose the supportStaffID = 90, the email still send out the gridview details of supportSTaffID = 78
how do i assign values dynamically??how must i change the url that whoever supportSTaffID i choose the respective gridview details is sent??any idea?
If myMailMessage.Body = "" Then
myMailMessage.Body = Label0.Text + Label2.Text
myMailMessage.IsBodyHtml = True
End If
btn_Send.Visible = False
' Retrieve HTML via HTTP request to use as body of email
Dim GetHttpWebPage_Obj As New GetHttpWebPage
myMailMessage.Body = GetHttpWebPage_Obj.returnWebContain("http://localhost:3486/Sample/EmailTemplate/StatusEmail.aspx?SupportStaffID=78")
but i got one problem,i can display the gridview for the SupportStaffID = "78" as shown on my URL in bold..but when i choose the supportStaffID = 90, the email still send out the gridview details of supportSTaffID = 78
how do i assign values dynamically??how must i change the url that whoever supportSTaffID i choose the respective gridview details is sent??any idea?
gald you can do it hehe, i not familiar with this kind of approach so no much comment whether it can work or not btw here is sample of dynamic staffid binding
If myMailMessage.Body = "" Then
myMailMessage.Body = Label0.Text + Label2.Text
myMailMessage.IsBodyHtml = True
End If
btn_Send.Visible = False
' Retrieve HTML via HTTP request to use as body of email
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 27, 2009 09:46 AM|LINK
as i said you need to convert it to html format first, you cannot directly convert it tostring() only
and set the format body of the mail to HTML
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 28, 2009 02:48 AM|LINK
how do i convert it??i dont know..i do all wrong..haix..can please help? :(
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 28, 2009 02:55 AM|LINK
hmm can you gv me the datatable / gridview structure and also the output format that you expect to have
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 28, 2009 03:01 AM|LINK
the gridview has columns like : ID,Requester, Subject,Category,CategoryType, Priority,Status and description
i want the output to be showing:
--------------------------------------------------------------------------------------
The following tickets are opened/inprogress and KIV
the gridview with all the details will be shown here
please attend to the tickets as soon as possible
--------------------------------------------------------------------------------------
i am able to display the 2 lines but not the gridview..how do i do that?do u need any of my codes?
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 28, 2009 03:20 AM|LINK
okie wait let me see how to write it out
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 28, 2009 03:22 AM|LINK
hey mo meng..now i can display the gridview already..
i missed one line which was - myMailMessage.IsBodyHtml = True :D
i actually used this method which is HTTPWebRequest
i have this class with this function..
---------------------------------------------------------------------------
Public Class GetHttpWebPage
Function returnWebContain(ByVal Url As String) As String
Dim myWebRequest As WebRequest
Dim myStreamReader As StreamReader
Dim strBody As String = ""
myWebRequest = WebRequest.Create(Url)
myWebRequest.Proxy = New WebProxy("proxy.int.stee.com.sg", 8080)
myStreamReader = New StreamReader(myWebRequest.GetResponse().GetResponseStream())
strBody = myStreamReader.ReadToEnd
myStreamReader.Close()
Return strBody
End Function
--------------------------------------------------------------------------------------
and i call this function behind my send button like this:
-----------------------------------------------------------------------------------------
If myMailMessage.Body = "" Then
myMailMessage.Body = Label0.Text + Label2.Text
myMailMessage.IsBodyHtml = True
End If
btn_Send.Visible = False
' Retrieve HTML via HTTP request to use as body of email
Dim GetHttpWebPage_Obj As New GetHttpWebPage
myMailMessage.Body = GetHttpWebPage_Obj.returnWebContain("http://localhost:3486/Sample/EmailTemplate/StatusEmail.aspx?SupportStaffID=78")
mySmtpClient.Send(myMailMessage)
-------------------------------------------------------------------------------------------------
but i got one problem,i can display the gridview for the SupportStaffID = "78" as shown on my URL in bold..but when i choose the supportStaffID = 90, the email still send out the gridview details of supportSTaffID = 78
how do i assign values dynamically??how must i change the url that whoever supportSTaffID i choose the respective gridview details is sent??any idea?
pls help! (:
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 28, 2009 03:23 AM|LINK
hey mo meng..now i can display the gridview already..
i missed one line which was - myMailMessage.IsBodyHtml = True :D
i actually used this method which is HTTPWebRequest
i have this class with this function..
---------------------------------------------------------------------------
Public Class GetHttpWebPage
Function returnWebContain(ByVal Url As String) As String
Dim myWebRequest As WebRequest
Dim myStreamReader As StreamReader
Dim strBody As String = ""
myWebRequest = WebRequest.Create(Url)
myWebRequest.Proxy = New WebProxy("proxy.int.stee.com.sg", 8080)
myStreamReader = New StreamReader(myWebRequest.GetResponse().GetResponseStream())
strBody = myStreamReader.ReadToEnd
myStreamReader.Close()
Return strBody
End Function
--------------------------------------------------------------------------------------
and i call this function behind my send button like this:
-----------------------------------------------------------------------------------------
If myMailMessage.Body = "" Then
myMailMessage.Body = Label0.Text + Label2.Text
myMailMessage.IsBodyHtml = True
End If
btn_Send.Visible = False
' Retrieve HTML via HTTP request to use as body of email
Dim GetHttpWebPage_Obj As New GetHttpWebPage
myMailMessage.Body = GetHttpWebPage_Obj.returnWebContain("http://localhost:3486/Sample/EmailTemplate/StatusEmail.aspx?SupportStaffID=78")
mySmtpClient.Send(myMailMessage)
-------------------------------------------------------------------------------------------------
but i got one problem,i can display the gridview for the SupportStaffID = "78" as shown on my URL in bold..but when i choose the supportStaffID = 90, the email still send out the gridview details of supportSTaffID = 78
how do i assign values dynamically??how must i change the url that whoever supportSTaffID i choose the respective gridview details is sent??any idea?
pls help! (:
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 28, 2009 03:34 AM|LINK
gald you can do it hehe, i not familiar with this kind of approach so no much comment whether it can work or not btw here is sample of dynamic staffid binding
If myMailMessage.Body = "" Then
myMailMessage.Body = Label0.Text + Label2.Text
myMailMessage.IsBodyHtml = True
End If
btn_Send.Visible = False
' Retrieve HTML via HTTP request to use as body of email
Dim GetHttpWebPage_Obj As New GetHttpWebPage
myMailMessage.Body = GetHttpWebPage_Obj.returnWebContain("http://localhost:3486/Sample/EmailTemplate/StatusEmail.aspx?SupportStaffID="+staffID)'pass the parameter here
mySmtpClient.Send(myMailMessage)
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 28, 2009 04:26 AM|LINK
haha..okay! (:
hey i tried like what u said to pass the id dynamically..
but when i click on the send button,i get an error which is - The remote server returned an error: (500) Internal Server Error.
--------------------------------------------------------------------------------------------------------
Function returnWebContain(ByVal Url As String) As String
Dim myWebRequest As WebRequest
Dim myStreamReader As StreamReader
Dim strBody As String = ""
myWebRequest = WebRequest.Create(Url)
myWebRequest.Proxy = New WebProxy("proxy.int.stee.com.sg", 8080)
'myWebRequest.Credentials = New NetworkCredential("HanHeong", "Wohaha123", "stts")
myStreamReader = New StreamReader(myWebRequest.GetResponse().GetResponseStream())
strBody = myStreamReader.ReadToEnd
myStreamReader.Close()
Return strBody
End Function
--------------------------------------------------------------------------------------------------------
error at the line in bold..why is that so??any idea??
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 28, 2009 04:41 AM|LINK
i not familiar with this approach .. hehe so cannot comment but you said when hard code it it works rite than
when u debug this function, what is the URL passed in? correct with the approriate ID?