Sending E-mail with .Net, the Easy Way
You can send robust e-mail messages from your .Net
app within minutes...
In this edition of E-mail Secrets you will learn the
basics of sending e-mail with .Net. We will take a look at
the issues pertaining to the needs of most developers and explain
them in an easy to understand way. We will try to stay away
from complicated topics such as MIME, Base64, etc... Most of the
software that we will use to send the messages is free and shields the developer from a learning curve. Most
importantly, we will show you how to start sending e-mail from
your .Net apps right away. The included sample code can be
downloaded and you can be sending e-mail like a pro in minutes...
In this edition you will learn:
The basics of sending e-mail
How to attach files to your messages
How to send an HTML message that contains support for non HTML
Several reasons why the System.Web.Mail classes are not your
How to send e-mail through a server that requires authentication
How to overcome the #1 problem most developers encounter when
trying to send e-mail from their application
This edition also contains sample code that will enable you
Create and send an e-mail message with only one line of code
Create and send a message containing an attachment
Create and send an HTML e-mail message with text support for non HTML
Send a message through a server that requires authentication
Specify backup servers for your outgoing message
Do you really want to look under the hood?...
Sending e-mail is either incredibly complicated, or a very
simple task. It all depends on your perspective. Every
day we get into our cars and drive from here to there, mostly not
worrying about the mechanics under the hood. E-mail is
similar. Users of popular e-mail software can send an e-mail
message without having to worry about the low level details such
as RFC-822, MIME, Base64, etc...
Developers of e-mail applications often find themselves
wrestling with these details, but that does not have to be so.
With the advent of several excellent developer tools (assemblies
in .Net speak), any developer with even trivial .Net experience
can send e-mail like the pros without worrying about the
complexities "under the hood."
I am not going to dwell on these complexities, because I don't
believe that you need to understand them to build a successful
e-mail enabled application. If you appreciate the finer
details of the process, there are plenty of RFC's on the Internet
which you can spend countless hours deciphering. Suffice it
to say that I have done that so you don't have to. For those
who want to build dependable applications that send e-mail,
without investing in a large learning curve, read on...
The very basics...
Even though I promised not to waste your time and/or bore you
with the low level details, I want to give you a basic primer on
e-mail technology because I think that it will help you ground
yourself and enable you to relate what I have to say in this
article with other things you may read.
E-mail is delivered across the Internet with the SMTP protocol.
The SMTP protocol dictates how e-mail messages are submitted to
the Internet and delivered to the recipient. The construct
of each message is governed by many other specifications.
The specifications for SMTP and the construct of messages are
contained in the multitude of RFC's floating around the Internet.
Without diving into all the internals, I want you to know that
the code in this newsletter will enable you to build messages that
take advantage of all the latest e-mail technologies while
preserving compatibility across the different mail servers and
readers on the net.
Enough said, lets get on with it.
The following sample will show you how to send e-mail from
your .Net applications with only one line of code...