system.net.mail - Help

hi all..
i used system.web.mail in my previous codes.. now i cannot send email... 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.




0
lady_naruto
8/25/2005 8:10:28 AM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
662 Views

Similar Articles

[PageSpeed] 9

I had asked about (and then figured out) some working code on this post

http://forums.asp.net/1007397/ShowPost.aspx

hope that helps
"If you make it idiot proof, they'll build a better idiot"
0
MorningZ
8/25/2005 12:47:31 PM
tnx for the reply .... i found out the error.. i have to change ASP.net
version to 2.xxxxxx now im having a new dilemma.. i dunno if i have to
post this on a new thread.. but my problem now is that when 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 or in QUEUE... im sure i filled up all the necessary info.. im not sure why its in BADMAIL..

i cant figure this out because.. months ago. when i used system.web.mail. i can send mail within our connection (notes client) but cannot send outside of the company.

Please help.. im using WINXP.

0
lady_naruto
8/25/2005 1:48:54 PM
Reply:

Similar Artilces:

What additional advantage we get through System.net.mail over the old system.web.mail?
What additional advantage we get through System.net.mail over the old system.web.mail?Is it needed to configure the smtp server? Plz tell me the steps to develop the email sending facility in our applicationSwati Jain Take a look at www.systemnetmail.com.JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Value of type 'System.Net.Mail.MailMessage' cannot be converted to 'System.Net.Mail.AlternateView'
Trying to create an alternateview to send a txt email with the html formatted email.  I've used string builder to create the whole email, but I get this error.  Any ideas why?  i've bolded the line that throws the error... Dim EmailBodyTxt As New StringBuilder EmailBodyTxt.Append("<html><style type='text/css'>.table{border:solid; border-color:#006666; width:600;} ")EmailBodyTxt.Append("<body><table class='table'><tr><td colspan='2'><h1>Test<br />RESPONSE SYSTEM</h1></td>...

get mail using System.Net.Mail
How can i get Email usign System.Net.Mail ?? Hello poloxy  ,the System.Net.Mail used only for sending emails and not to receive them.Read the full documentation at  MSDN Library http://technet.microsoft.com/en-us/library/system.net.mail.aspx  Hosam Kamel Remember to click on Mark as answer on the post that helped you SO how can I receive mail ? Try one of these pop3 librarieshttp://www.codeproject.com/info/search.aspx?artkw=pop3  Hosam Kamel Remember to click on Mark as answer on the post that helped you HI,   if you want to send email by using System....

System.Net.Mail is giving error CS0029: Cannot implicitly convert type 'string' to 'System.Net.Mail.MailAddress'
I'm getting an error while trying to use the wizard to create a form and than pass it the vaibles to Mail. Any help would be much appreciated. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try {   message.From = txtEmail.Text; message.To.Add("admin1@yoursite.com"); message.Subject = "Feedback"; message.CC.Add("admin1@yoursite.com"); message.CC.Add("admin2@yoursite.com"); message.IsBodyHtml = false; message.Body = txtMessage.Text; smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lbl...

.net 2 beta 2 - System.Net.Mail
Hi guysI'm using the System.Net.Mail namespace in .net version 2, beta 2, to send out some HTML formatted e-mails.However, for some reason when the e-mail are sent out some of the full stops from the e-mail are removed.For example, part of the e-mail contains this code<img src="http://www.avonandsomerset.police.uk/images/grey_box_bottom.gif" alt="">But this is what the code is like when the e-mail source code is viewed<img src="http://www.avonandsomerset.police.uk/images/grey_box_bottomgif" alt="">Is this a known bug in beta 2? If so, where can I view a list of known bugs an...

I am not getting my mail open on my net as net is running
Name: Email: rmbala91atgmaildotcom Product: Firefox Summary: I am not getting my mail open on my net as net is running Comments: My mail is not getting opening. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

System.web.mail to System.net.mail
I converted a asp.net web app from VS 2003 to VS 2005. i now get error message when i build it  stating system.web.mail  is obsolute,  use system.net.mail i redefine to system.net.mail but now i get other error message such as smtpMail does not exist in the current context. cannot implicitly convert type string to System.Net.Mail.MailAddress   so System.Web.Mail want work in ASP.net web app convert to VS 2005 running on framework 2.0?           because if i change to System.Net.Mail  i am ...

About: how can i send a MIME(Text und Html Format) Mail by System.Net.Mail und .Net 2.0
Helle to all, I hope that someone can help me. I need to implement a programm to send newsletters. The newsletter Format can be Html, Text and MIME(Html and Text). when using CDONTS library man can set MailFormat = MIME. But i use System.Net.Mail and there are only text or html Format. Can someone tell me how can i use System.Net.Mail to send a MIME Mail? Thanks Best Regards Pinsha perhaps this link can help:  http://systemnetmail.com/faq/3.1.3.aspxIn this world there are 10 types of people, those that know binary and those who don't....

Migrating from System.web.mail to System.net.mail
Hi Every1,I've recently used the System.web.mail to send mail, using the IIS's smtp server.Doing this, i didn't really need to do anything in the web.config file or give any special parameters to the client. It just assumed i was working with my very own smtp service that came with the IIS and everything worked fine.Now i migrated to System.net.mail and now i need to insert my smtp service's host location under <system.net> in the web.config file.However, i don't know what to write there so the client will use my smtp sevice (host="localhost" doesn't work)can any1 help me on this one?t...

Working with System.Web.Mail but not with System.Net.Mail
Hi, i am having trouble sending e-mails using System.Net.Mail namespace while there is no problem with System.Web.Mail. I am  using remote smtp server with no authentication.  My code as shown below:1 try2 {3 MailMessage message = new MailMessage();4 message.BodyFormat = MailFormat.Html;5 message.To = "admin@mydomain.com";6 message.From = "test@mydomain.com";7 message.Subject = "Test Smtp";8 message.Body = "TestMail 123";9 10 SmtpMail.SmtpServer = "mail.mysmt...

System.Web.Mail vs System.Net.Mail
Hi AllI was using System.Web.Mail in an application on our test server.  That worked fine.  I never had to specify a server or change any settings.  It just works.  Whatever settings the server has set up are used.  This is great.I saw that System.Web.Mail has been deprecated, so I'm trying to use System.Net.Mail.  I'm having a problem.  Net.Mail doesn't use whatever settings Web.Mail used.  I can't send e-mail with Net.Mail.  I see several people use the web.config file to set the server up, but I can't get that to work. I jus...

Changing System.Web.Mail to System.Net.Mail
I am trying to learn ASPI have been using the Visual Web Developer 2005I have the following line that I can not work out how to convert.<%Dim FromForm As String = "Mail@Myname.co.uk"Dim ToMe As String = "Me@myname.co.uk"Dim FormSubject As String = "Contact Infomation"Dim EmailText As String = "Blar Blar Blar"System.Web.Mail.SmtpMail.Send(FromForm,ToMe,FormSubject,EmailText)%>It tells me that I cannot use System.Web.Mail any more and should use System.Net.Mail. I have been unable to work out what the new code should be to get it to work.The Language is VBCan anyone tell me how to change...

useing System.Net.Mail in Net 2.0
Useing C# and VWD enviroment with the Test server in VWD. Code for Mail does not work in 2.0, get an error like this:  System.Net.Mail.SmtpException was unhandled by user code Message="Failure sending mail." Source="System" line 42 which is the smtp.Send(email) line. Code for the old way in 1.1 works just fine, here is what I use (email is bogus for this) The commented line are for Net 1.1 which works. Any ideas what I need to do? Thanks using System.Net.Mail;//using System.Web.Mail; protected void Button1_Click(object sender, EventArgs e)  {  ERMessag...

difference between System.Web.Mail and System.Net.Mail
What is difference between System.Web.Mail and System.Net.Mail  namespace?What is use of both ? System.Web.Mail was in .NET Framework v1.1System.Net.Mail is in .NET Framework v2.0 and greaterSame use, although there is more functionality in System.Net.Mail since it is a later version of the framework. Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!  What All-Star said. I assume the reason it was moved to a different namespace is because the internet is actually a suite of technologies: e-mail, ftp, http (web), etc. E-mail and...

switching from system.web.mail to system.net.mail
I have been converting my code from system.web.mail to system.net.mail.  I have been able to convert the to, from, cc, and message body to the new format easily but...my question is how do i convert this into system.net.mail format?SmtpMail.SmtpServer = "server";                SmtpMail.Send(mail);Would this be the solution?SmtpClient client = new SmtpClient("server");                client.Send(mail); Here's a full example of how to per...

Web resources about - system.net.mail - Help - asp.net.getting-started

List of areas in the United States National Park System - Wikipedia, the free encyclopedia
The National Park System of the United States is the collection of physical properties owned or administered by the National Park Service . This ...

Shared Services Canada's Move To Put Federal Worker On New Email System Halted
The goal was to increase digital security. OTTAWA — The department in charge of creating a single email system for the federal government says ...

Compulab Rolls-Out Passively-Cooled Airtop Systems
Compulab, a maker of miniature and small form-factor computers, is introducing its first desktop system called Airtop today. The new computer ...

NYC police boss urges 'buddy system' for women in cabs
Filed under: Green , Transportation Alternatives NYC Police Commissioner William Bratton says women should, 'adopt the buddy system' when they ...

Don’t buy a home audio system before you check out these deals
... truth that some people have trouble accepting: You should never use the built-in speakers in HDTVs. Buying a separate home audio system doesn't ...

42% OF AMERICANS NOW REJECT 2-PARTY SYSTEM: Confirm That Government is the Problem
... 16% of Independents admitted leaning Democratic and another 16% admitted a Republican tendency, evidencing the weight of the two-party system ...

JetBlue Site Experiencing “Intermittent System Outages” That’s Messing With Online Check-In, Boarding ...
... checking in online, or printing boarding passes on JetBlue.com, you aren’t alone: the airline said that it’s having issues with its system, ...

GOP Lawmakers Call On IRS To Fix Audit System And Protect First Amendment
GOP Lawmakers Call On IRS To Fix Audit System And Protect First Amendment

Shufro Rose & Company Sells $22268000 in Cisco Systems, Inc. (CSCO) Shares
Shufro Rose & Company Sells $22268000 in Cisco Systems, Inc. (CSCO) Shares EMQ Cisco Systems logo Shufro Rose & Company decreased its stake ...

Solus Operating System 1.0 Provides New Linux Desktop Experience
A feature of the Solus Project's new Linux distribution is the new Budgie desktop environment. Here's what else Solus Operating System 1.0 offers. ...

Resources last updated: 1/16/2016 6:12:00 AM