About: System.Web.Mail (SWM)

API Type: SMTP Sender
API Interface: 
.NET Framework Namespace Classes.
Business Logic: Sending mail via SMTP.
Language Support: .NET Languages only.
Direct Property Access: N/A.
Product Versions: All versions of .NET Framework (as of 3.5).
The System.Web.Mail namespace was the original email messaging class in the .NET Framework.  It is a simple wrapper around CDOSYS.  The functionality availabe in SWM is actually a subset of that that is available in CDOSYS.  SWM can send email messages via SMTP through a local pickup directory or via port to an remote SMTP server.
Some Points Of Interest:
  • SWM is managed wrapper around CDOSYS - it only provides a subset of the functionality to send messages via SMTP, it does not do the same MIME parsing that CDOSYS can do.
  • SWM is replaced in the .NET Framework 2.0 by the System.Net.Mail namespace.
  • For whatever reason, a common mistake made when using SWM's SmtpMail class is to set the the SmtpServer property using the Insert(string) method off the SmtpServer property (which is a string).  The Insert method doesn't set the SmtpServer property so it remains empty - what does is it this changes the send method from port to local pickup directory. 
  • Debugging SWM issues is very systematic, there are only so many ways to send mail using SWM. 
  • Problems usually arise from changes to the configuraiton of the SMTP server - either added authentication requirements, server names, or open availability.  
  • Consider using System.Net.Mail or CDOSYS if you run into issues with System.Web.Mail since those are still supported and have broader capabilities.


System.Web.Mail Namespace

MailMessage Class

How to send e-mail programmatically by using System.Web.Mail in Visual C# 2005 or in Visual C# .NET

Migrating from System.Web.Mail to System.Net.Mail

Also see:

About: SMTP Sending APIs

About: Messaging APIs



Comments (0)

Skip to main content