smtpMail

Discussion in 'ASP.NET / ASP.NET Core' started by l30nru, May 2, 2012.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi

    This code has been working for months but suddenly stopped working last night, DASP claim they have made NO changes their end. This code is also in a try catch end try statement and give no error?

    Code:
      
                Dim strFrom = "[email protected]"
                Dim strTo = "[email protected]"
                Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
                MailMsg.Subject = "Subject"
    
                Dim emailPage As String = "https://www.domain.com/dir/page.aspx?n=" & var1& "&r=" & var2 & "&addr=" & var3
    
                '
                '            'this lot loads a page
                Dim req As WebRequest = WebRequest.Create(New Uri(emailPage, UriKind.RelativeOrAbsolute))
                Dim res As WebResponse = req.GetResponse()
                Dim sr As New StreamReader(res.GetResponseStream())
                Dim html As String = sr.ReadToEnd()
    
                MailMsg.Body = html
                MailMsg.IsBodyHtml = True
    
    
                ' Smtpclient to send the mail message
                Dim SmtpMail As New SmtpClient
                SmtpMail.Host = "localhost"
                SmtpMail.Send(MailMsg)
    
                Response.Redirect("page2.aspx")
    I know the error has something to do with the email sending the emailPage but emailPage loads fine if i hit it in a browser but again no error is coming back?

    Any help would be appreciated.

    Thanks

    L
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    What do you mean by the code is not working if you are not getting any error?
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page