i used system.web.mail in my previous codes.. now i cannot sendemail... when i used VWD it says that the code im using is obsolete,and that i have to use system.net.mail
here's the code i found in one of the threads
-- Begin Code --
Dim msg As New System.Net.Mail.MailMessage
Dim smtp As New System.Net.Mail.SmtpClient
With msg
.From = New System.Net.Mail.MailAddress("From Mail Address")
.To.Add(New System.Net.Mail.MailAddress("To Mail Address")
.Subject = "Important Message"
.IsBodyHtml = False
.Body = "This email is marked as urgent."
.Headers.Add("Importance", "High")
End With
Try
smtp.Host = "Host Server"
smtp.Send(msg)
Catch ex As Exception
'Handle error
End Try
-- End Code -- (thanks to mr. Jeremy Lucas)
but when i tried the code.. i encountered an error..
Description:An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message:BC30002: Type 'System.Net.Mail.MailMessage' is not defined.
Source Error:
Line 105: Dim msg As New System.Net.Mail.MailMessage
Line 106: Dim smtp As New System.Net.Mail.SmtpClient
Line 107:
im trying to figure this out by importing namespaces like
<% Import namespace ="system.net.mail.smtpclient"%>
<% Import namespace ="system.net.mail.mailmessage"%>
still,, i get the same error.. please help... im totally lost.
I had asked about (and then figured out) some working code on this post
http://forums.asp.net/1007397/ShowPost.aspx
hope that helps
tnx for the reply ... i found out the error.. i have to change ASP.netversion to 2.xxxxxx now im having a new dilemma.. i dunno if i have topost this on a new thread.. but my problem now is thatwhen i tried the code.. it seems ok.. but when i check my mail.. its BLANK...
i checked the mailroot... seems like my mails are either in BADMAIL orin QUEUE... im sure i filled up all the necessary info.. im not surewhy its in BADMAIL..
i cant figure this out because.. months ago. when i usedsystem.web.mail. i can send mail within our connection (notes client)but cannot send outside of the company.
Please help.. im using WINXP.
0 comments:
Post a Comment