Error sending ASPX pages in HTML mail
Examine the log file and see what was asked to be served up. You may find an
error here.
Another thing to remember. HTML mail is designed to send HTML to a user in
place of text, not necessarily to serve up pages and then send them to
someone. The norm is to make an HTML template with a section that can be
replaced with each email. You then stick a piece of HTML in the middle. Your
method, while not necessarily "wrong," is certainly unorthodox.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge
****************************************************************************
****
Think Outside the Box!
****************************************************************************
****
Quote:
> Hi guys,
> I use the code below to send HTML emails to my customers, but when I try
to
> send an ASPX page, I get the following error message:
> "Exception Details: System.Net.WebException: The remote server returned an
> error: (500) Internal Server Error."
> Here's the code:
> Dim client As WebClient = New WebClient()
> Dim buffer() As Byte = client.DownloadData("http://xxxx.aspx")
> Dim str As String = Encoding.ASCII.GetString(buffer)
> Dim mail As MailMessage = New MailMessage()
> mail.UrlContentBase = "http://xxxx"
> mail.Subject = "test"
> mail.Body = str
> mail.Priority = MailPriority.Normal
> mail.BodyFormat = MailFormat.Html
> SmtpMail.SmtpServer = "mailrelay.bostream.com"
> SmtpMail.Send(mail)
> The page works just fine when accessing it in a web browser. What could be
> wrong?
> Regards,
> Jonah Olsson