Download the Code [^] -
Updated 4/12/2002
Sending email from Asp.Net is extremely simple. In this first part, we'll
look at what it takes to send a basic message (text or Html) with or without an
attachment. In addition, as we progress we also add:
- the ability to send mail from a database
- replace fields in the message body with database values
The current code allows you to send one message to one target. The message
you enter can be in text or html, with or without an attachment. If you send the
message as html, merely enter your html codes (<b></b>) as part of the body of
the message. In addition, you can also pre-format an Html Web page and send it
as the message.
There are a few basic function in the UserClasses folder. The code for this
application is contained in the MailTo.aspx MailTo.aspx.cs files. The only
documentation that exists is in the MailTo.aspx.cs file as regular C++ (//)
comments. If you move the code and use the file attachment, make sure you look
closely at the form definition. Make sure that you include enctype="multipart/form-data"
in the definition or you may spend unnecessary time trying to find errors.
Much of the current code is written to accomodate the integration of the
existing functions into the database version on the application which will be
the subject of part 2 of this article.
I have been using a version of this program for about the last two months and
using the database version I have sent messages to over 2,680 receipants - each
message personalized with first and last name as well as the individuals user id
and password.
A sample implementation can be found
HERE [^]
Top 