About: SMTP Sending APIs

Summary:

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. 

The APIs:

Troubleshooting:

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
https://support.microsoft.com/en-us/kb/153119

How to Use Telnet to Test SMTP Communication
https://technet.microsoft.com/en-us/library/aa995718(v=exchg.65).aspx

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. 

Also see:

About: Messaging APIs
https://blogs.msdn.com/b/webdav_101/archive/2015/08/07/about-messaging-apis.aspx