Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

system.web.mail vs system.net.mail [duplicate]

Tags:

c#

asp.net

What is the difference between System.Web.Mail and System.Net.Mail?

like image 343
Nithesh Narayanan Avatar asked Apr 11 '11 07:04

Nithesh Narayanan


People also ask

What is System Net Mail?

Allows applications to send email by using the Simple Mail Transfer Protocol (SMTP). The SmtpClient type is obsolete on some platforms and not recommended on others; for more information, see the Remarks section.

Where is System Net Mail?

The System. Net.Mail classes are contained in the "System. dll" file. Make sure you have a reference to System listed under References in your project.


2 Answers

  • System.Web.Mail was in .NET Framework v1.1

  • System.Net.Mail is in .NET Framework v2.0 onwards

They are both used for the same purpose. If you use System.Web.Mail it only shows a warning, saying this is deprecated. It still works as supposed to.

If you are really using higher version (2.0 or later) of .NET framework, then use System.Net.Mail.

like image 75
Nirmal Avatar answered Sep 29 '22 05:09

Nirmal


First line in MSDN for the System.Web.Mail namespace:

The classes in this namespace have been deprecated. Use the System.Net.Mail namespace instead

like image 40
jgauffin Avatar answered Sep 29 '22 04:09

jgauffin