Chapter 41: ASP Sending e-mail with CDOSYS

ASP Sending e-mail with CDOSYS — the classic, battle-tested, and still widely used way to send emails from Classic ASP pages in 2026 (especially in legacy Indian banking, government, ERP, small-business, and intranet systems).

I will explain it like your favorite teacher who actually wrote, debugged, and supported CDOSYS email code in production Classic ASP applications from ~2003–2010 — slowly, clearly, with real working examples, common pitfalls, security warnings, best practices, and why this method refused to die even after Microsoft tried to kill it.

1. Why CDOSYS? (Quick History – Why Everyone Still Uses It in 2026)

Technology Introduced Supported until Status in 2026 legacy code Why people still use it
CDONTS 1996 ~2003 Almost dead Very old, insecure, removed from Server 2003+
CDOSYS 2000 Officially ~2008 Still very common Last Microsoft-supported COM email component for Classic ASP
System.Net.Mail 2002 (ASP.NET) Active Not available in Classic ASP Requires .NET Framework — not usable in pure VBScript
Third-party (ASPMail, etc.) 1990s–2000s Varies Rare Cost money, licensing issues

CDOSYS (Collaborative Data Objects for Windows 2000 — later just called CDOSYS) became the standard because:

  • It came free with Windows Server 2003 / IIS 6+
  • It supported modern SMTP (authentication, SSL/TLS, HTML emails, attachments)
  • It was much more reliable than the old CDONTS
  • It worked perfectly with VBScript in Classic ASP

Even in 2026, when you see a Classic ASP site sending emails, 90%+ chance it is still using CDOSYS.

2. The Two Most Common CDOSYS Patterns in Real Code

There are two typical ways people wrote CDOSYS code in Classic ASP:

  1. Using the Configuration object (recommended, supports authentication, SSL, etc.)
  2. Quick & dirty one-liner style (only basic unauthenticated SMTP)

We will focus on #1 — because almost every real site that sends mail to Gmail/Office 365/custom SMTP uses the full Configuration style.

3. Full Realistic Example – Contact Form Sends Email with CDOSYS

File: contact.asp

asp

4. The Most Important Configuration Fields (You Must Know These)

Schema URL (long but must be exact) Common values What it means
http://schemas.microsoft.com/cdo/configuration/sendusing 2 2 = Network (SMTP), 1 = Local pickup
http://schemas.microsoft.com/cdo/configuration/smtpserver “smtp.gmail.com”, “smtp.office365.com” Your SMTP server
http://schemas.microsoft.com/cdo/configuration/smtpserverport 25, 587, 465 587 = TLS, 465 = SSL
http://schemas.microsoft.com/cdo/configuration/smtpusessl True / False Use SSL/TLS encryption
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate 0 = None, 1 = Basic 1 = username/password required
http://schemas.microsoft.com/cdo/configuration/sendusername yourname@gmail.com SMTP login
http://schemas.microsoft.com/cdo/configuration/sendpassword your-app-password SMTP password (use App Password for Gmail)

5. Teacher Warnings & Best Practices (Very Important in 2026)

  • Gmail / Office 365 require App Passwords — normal password no longer works (2FA blocks it)
  • Never store password in plain text — use #include file outside web root or registry/encrypted config
  • Use .HtmlBody for HTML emails, .TextBody for plain text
  • Add .CC, .BCC, .ReplyTo, .Importance when needed
  • Handle errors with On Error Resume Next + check Err.Number
  • Test thoroughly — SMTP servers are picky (timeout, auth, SSL versions)

6. Quick Summary – ASP Sending Email with CDOSYS

CDOSYS is the standard way Classic ASP sites sent emails 2003–2012 (and still do in legacy systems):

  • Create CDO.Message and CDO.Configuration objects
  • Configure SMTP server, port, SSL, username/password in .Fields
  • Set .From, .To, .Subject, .HtmlBody / .TextBody
  • Call .Send
  • Clean up objects with Nothing
  • Always validate input and encode output

This is how millions of contact forms, order confirmations, password resets, and alerts were sent from Classic ASP — and many legacy Indian small-business, internal, government, and ERP systems still use exactly this CDOSYS pattern in 2026.

Next class?

  • Want a forgot password + reset link example with CDOSYS?
  • Or how to send attachments (PDF invoice, resume)?
  • Or error logging when email fails?
  • Or compare CDOSYS vs modern ASP.NET Core MailKit / SmtpClient?

Just tell me — I’m here! 🚀🇮🇳 Keep learning strong, Webliance! 😊

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *