If you were to say "programmatically send an email in .NET" to a .NET programmer, he'd almost immediately reply "SmtpMail class in System.Web.Mail." A less experienced .NET programmer might take a moment to search the documentation, and then reply "SmtpMail class in System.Web.Mail." Someone with absolutely no .NET programming experience would take a few minutes on Google, and then reply "SmtpMail class in System.Web.Mail."
When Maxim Rouiller's predecessor (the company's former .NET whiz) was presented with the requirement to "programmatically send an email in .NET," he used a slightly different approach. With the change log and source control history, Maxim was able to reconstruct the trials and tribulations he must have gone through to finally master this requirement.
2004-12-02 13:29 -- Check in code that does the following: Programmatically execute outlook.exe and wait five seconds for it to load up. With the outlook process in the foreground, send the following keystroke combination to outlook: {ctrl+n}, [email protected], {tab}, {tab}, Some Subject Line, {tab}, The Message Body, {ctrl+enter}.Close the outlook process.
2004-12-02 14:07 -- Deploy to the server and learn that it doesn't work so well. Go back to the drawing board.
2004-12-03 11:18 -- Check-in a custom email class that wraps around the CDONTS library.
2004-12-03 12:39 -- Deploy to the server and learn that, because it is Windows 2003, it does not have CDONTS installed. Go back to the drawing board
2004-12-06 13:36 -- Check-in another custom email class that interops the Microsoft Outlook automation objects.
2004-12-06 13:51 -- Deploy to the server and learn that Outlook has an anti-hijacking feature that requires the user to click "Yes" to send an email. Learn that, as a web application, the web user is not presented with a dialog window that pops-up on the server.
2004-12-07 07:18 -- Check-in an attempt to automatically click yes.
2004-12-07 09:03 -- Check-in another attempt to automatically click yes.
2004-12-07 10:28 -- Check-in yet another attempt to automatically click yes.
2004-12-07 16:22 -- Install, on the server, a newly purchased program called ClickYes that automatically clicks "Yes" to those dialogs.
Maxim took it upon himself to improve this process. After a few minutes, he had checked in a new approach: the SmtpMail class in System.Web.Mail.