Mailmessage sending different page

liunx

Guest
HI all,

Im trying to send an email that has the body of another page.Meaning
a.aspx is the email sending page and in the email the body is the body of b.aspx?.... i dont want b to be seen this should happen on the back end.
And by the way im using MailMessage to send emails.
Thanks all.Dim client As New System.Net.WebClient
Dim sr As New System.IO.StreamReader(client.OpenRead("http://www.webdeveloper.com"))
Dim EBody As String = sr.ReadToEnd
client.Dispose()


That will read the HTML from your URI into the EBody string. Make sure that pictures, stylesheets, links, etc. all have absolute URI's like this "http://www.mydomain.com/picture.gif" otherwise they might not show for your end user.

Also, make sure that your mailmessage format is HTML and not plain text.

One more thing, just so you know, you can build the HTML page in your code like this:


dim EBody as string
EBody = "<html><body>" & System.Environment.NewLine()
EBody &= 'The Body of your HTML & System.Environment.NewLine()
EBody &= "</body></html>"


Notice the system.Environment.NewLine(), if your body is really long and you dont have any of those, the users email will have random "!" put into the HTML code and make it look all screwy.Dim client As New System.Net.WebClient
Dim sr As New System.IO.StreamReader(client.OpenRead("http://www.webdeveloper.com"))
Dim EBody As String = sr.ReadToEnd
client.Dispose()

This code worked it helped alot ty.NP, glad it did the job.
 
Back
Top