Microsoft has several APIs which send email by SMTP. These ‘SMTP Senders’ are meant to send email to SMTP servers and do not have access to a mailboxes or public folders. Mail submitted by SMTP will not be saved into the Sent Items of the sender’s mailbox. The beauty of these APIs is that they can send a lot of email very fast and do not need to go against Exchange or Outlook in order to work – they just need an SMTP server which will either pickup the email from its pickup folder or accept relay from the application using the API.
These APIs are used for sending mail via the SMTP protocol. These APIs are not Exchange or Outlook specific. They are shipped as either part of the Windows OS or with the .NET Framework.
About: System.Net.Mail (SNM)
System.Net.Mail is fully written in .NET code and can send by SMTP pickup folder and by SMTP port. It has many of the capabilities of CDOSYS.
About: System.Web.Mail (SWM)
The System.Web.Mail namespace was the original email messaging class in the .NET Framework. SWM is replaced in the .NET Framework 2.0 by the System.Net.Mail namespace. It is a partial wrapper for CDOSYS, however it had very limited functionality.
CDO for Windows 2000 (CDOSYS)
CDOSYS is a COM API which has been around since Windows 2000 and is still fully supported today. Its part of the Windows OS. This API can send to pickup folders, send by SMTP port, has good body manipulation abilities and can be used to also parse MIME.
CDO for Windows NT (CDONTS)
CDONTS is a very old API which sent email by SMTP pickup folder and was last supported with Windows 2000. CDOSYS was the replacement for it.
If you are running into issues with sending by SMTP port and don’t believe its your code then code then be sure to check to be sure the issue is not with the SMTP server or permissions:
XFOR: Telnet to Port 25 to Test SMTP Communication
How to Use Telnet to Test SMTP Communication
Some Points Of Interest:
If you get an error while sending to a pickup folder which seems to be permissions based then look at using ProcMon to see if there is an access denied for the application writing to the pickup folder.
If you get an error when sending all but very small email then there could be a permission error with the API writing to a temp folder. These APIs usually write out to a temporary folder with messages above a certain size – that size may vary. Use Procmon to see if there is an access denied in any temp folder and correct permissions so the application can write to it. Note that the temp folder may vary depending upon the type of application – windows form, windows service, web service, etc.
All code which sends by SMTP port needs to account for issues with the server being tied up – yes, an SMTP server may get overloaded or otherwise backed-up.
Sending by the pickup folder of locally installed SMTP server is usually the most efficient way to send email. It also does not tie up the thread sending the email. It the best way to send a large amount of email in almost every case.
About: Messaging APIs