Sending mail without installing an SMTP server

I have a .Net application. I want this application to send an email to me. How do I implement this without installing an SMTP server?


Solution 1:

Using an SmtpClient to send a MailMessage does not require you to have a server on your local machine.

Your e-mail service provider is the one with the server (e.g. smtp.gmail.com), and your SmtpClient talks to it.

Solution 2:

This article by Peter Bromberg on eggheadcafe.com

C# SMTP Mail without SMTP Service or CDO

explains how to send email without relying on an SMTP client:

Sending email via TCP using the native SMTP RFC commands "HELO", "MAIL From", RCPT TO", etc. is no big deal. That's one of the first tricks we learn with Telnet. Finding or writing managed code that will do so reliably is another story. The code in the class that follows is not my original code - I've cobbled it together from three different sample sources, fixing namespaces, error handling, and other minor items, changing console code to class library code, and providing a complete Winforms - based test harness front end that illustrates its correct usage.

I've also included sample code to correctly process and add a mail attachment via an OpenFileDialog here. This code MIME encodes and transmits the attachment(s) according to the specification.

Solution 3:

You can't send email without the services of a SMTP server, there is of course no need for you to install one, just point your code at your ISPs SMTP server or your companies Exchange server (or what ever they use).