ASP.NET 2.0 MailMessage issues

    Date: 11/11/05 (Asp Dot Net)    Keywords: web

    I'm converting a 1.1 webform to 2.0, and I'm having an issue trying to fix an obsolete class. System.Web.Mail has been obseleted so now I have to convert to the System.Net.Mail. I'm having a problem because now for some reason when I try to add the "from" and "to" parts of the email its giving me an error of "Value of type 'String' cannot be converted to 'System.Net.Mail.MailAddress.'" ...ummmm... so would an INTEGER be more appropriate? It also says, "Property 'To' is 'ReadOnly'." ....huh?

    Here's the code:

    Try
    Dim sMailMessage As String
    sMailMessage = fcnSendForm()

    Dim sErrMsg As String = fcnInsertDB()
    If sErrMsg.Trim <> "" Then

    Dim objMM As New MailMessage
    objMM.Subject = "Systems & Facilities Request Form ERROR"
    objMM.Body = sErrMsg & vbCrLf & vbCrLf & vbCrLf & sMailMessage
    objMM.From = "xxxxxxxxx@xxx.com" <----ERROR here type string can't be converted
    objMM.To = sErrorRecipient <------ERROR here property "to" is ReadOnly
    objMM.Priority = MailPriority.High
    SmtpMail.SmtpServer = sSMTPserver
    SmtpMail.Send(objMM)
    End If


    Any help would be greatly appreciated

    EDIT: Nevermind.. I think I solved this through some internet research. For those of you who have the same problem visit Mike's Blog

    Source: http://www.livejournal.com/community/aspdotnet/47455.html

« debugging in classic ASP || Visual Studio 2005 Panels... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home