codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » ASP » Article

Simple ASP.NET Email function

Article by:  Jeff Anderson  ( 1362 ) (1/21/2003)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Summary: Standard code for sending emails from within an ASP.NET application
Viewed: 209582 times Rating (42 votes): 
 3.8 out of 5
 Rate this Article  Read Comments  Post Comments

Simple ASP.NET Email function



Sending an email from within ASP.NET is easy as long as you have access to an SMTP server to deliver it. When using this code replace the line

mail.yoursmtpmailserver.com


with the name of your smtp mail server.

Select All Code


You can integrate the code further into your site, for example by setting the .to property of the mail object to a variable, perhaps read in from a form or a database. As an example, you could loop through all the email fields in a database table and send a mailshot to all your clients.

FORMAT

The alternative to the HTML email format shown here is plain text, in which case you set the format as follows:

Select All Code


To acheive line breaks within text format use VBCRLF (VB Carriage Return Line Feed). As in :

Select All Code







CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Simple ASP.NET Email function'
RELATED ARTICLES
ASP FilesystemObject
by Jeff Anderson
An introduction to the Filesystemobject
ASP GetTempName
by Jeff Anderson
Use the GetTempName method to create a randomly generated temporary file on the server.
ASP Format Date and Time Script
by Jeff Anderson
An ASP script showing the variety of date and time formats possible using the FormatDateTime Function.
ASP OpenTextFile
by Jeff Anderson
An introduction to the OpenTextFile Method of the FileSystemObject
Email validation using Regular Expression
by Jeff Anderson
Using regular expression syntax is an exellent way to thoroughly validate an email. It's possible in ASP.
Add or Subtract Hours in SQL or ASP using DateAdd
by Jeff Anderson
A beginners guide to using the SQL DATEADD function to add or subtract hours. Particularly useful when setting the time displayed on the ASP page to a different time zone (eg when the server is in the US, and the site is for a UK audience).
The asp:radiobutton and asp:radiobuttonlist control
by David Sussman, et al
In HTML, radio buttons are used when we need to make multiple sets of choices available, but we want the user to select only one of them.
ASP FileExists
by Jeff Anderson
An introduction to the FileExistsMethod of the FileSystemObject
The asp:checkbox and asp:checkboxlist control
by David Sussman, et al
Checkboxes are similar to radio buttons, and in HTML, they were used to allow multiple choices from a group of buttons.
Concatenate strings in sql
by Jeff Anderson
A brief introduction to concatenating strings in an sql query (using SQL server or access databases).








Recent Forum Threads
• SoftIce Driver Suite 3.0.1
• metrowerks codewarrior 9.0
• Mapinfo.Professional.v7.0
• GardenGraphics DynaSCAPE Professional 3.02
• Embroidery Great Notions 2004 part01-74
• EFI_BEST_COLORPROOF_V5.0
• AViD.SOFTiMAGE.XSi.V4.2.CD1-NNiSO
• AUTOFX.PHOTOGRAPHIC.EDGES.6.0.CD1
• 0 STI.SASSPro.v2.0.0.2 working full


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2014