Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · ASP.NET Newsletter Application · Web Hosting Plans · Faisal Khan's Blog · Contact
Search Stardeveloper.com
Newsletter
Enter your email address to receive full length articles at Stardeveloper:


Article Categories
.NET  .NET
  ASP (16)
  ASP.NET (41)
  ADO (16)
  ADO.NET (11)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)
Log In
UserName Or Email:

Password:

Auto-Login:

Miscellaneous Links
  Submit Article
Stardeveloper RSS Feed
Hosted by Securewebs.com
 
Home : .NET : ASP : How to send emails using Classic ASP?
 
RSS - Read full length articles at Stardeveloper using Stardeveloper RSS Feed RSS

How to send emails using Classic ASP?

by Tom Vergote.

Overview
Sending an email with asp is fairly easy, all you need is CDONTS (Collaboration Data Objects for NT Server, installed with IIS). In this article I'll show how to send emails with CDO, because it's available to everyone and components work in a very similar way. First we have to create instance of the NewMail object.

<%
	Option Explicit

	Dim objCDOMail
	Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
%>

The methods and property's of this object are very obvious.

<%
	objCDOMail.To = "somebody@somewhere.com"   'the destination
	objCDOMail.From = "me@mydomain.com"   'the sender
	objCDOMail.cc = "info@mydomain.com"   'carbon copy

	Dim txtBody
	txtBody = "This email has been sent by an asp script"
	objCDOMail.Subject = "CDONTS"   'the subject
	objCDOMail.Body = txtBody   'the body
	objCDOMail.Send   'fire off the email
%>

So far it has been pretty easy, hasn't it? There's more.

<%
	objCDOMail.AttachFile("c:\wwwroot\mysite\" & _
		"MyAttachement.doc", "pricelist.doc")
	objCDOMail.Bcc("blind@mysite.com")
	objCDOMail.Importance = 1
%>
  • The first rule defines an attachment ("PATH\TO\FILE", filename_that_appears)
  • The second rule sends a blind carbon copy
  • The third rule specifies the message's importance
      Importance:
    • 0 -> low
    • 1 -> default
    • 2 -> high

Thats it, I hope this article has been useful and i hope that now you will feel confident sending automated newsletters, confirmation emails and so on.

If you are looking for a production ready, stable, easy to use ASP.NET Newsletter application, then look no further: Faisal Khan (of Stardeveloper.com) has created a great Newsletter Application for you to download and start using today. It is easy to install, lets your users subscribe using a subscription form, provides a simple administration interface to create and send newsletters, handles the task of sending newsletters in the background using thread queues on the server, and lets users unsubscribe if they wish so.

Comments by the Author
Please post a lot of comments, as this is my first article. Tell me what you like/dislike so I can improve my future articles.


 ( No Further Pages )

Related Articles
  1. Server Side Email Addresses Validation using VBScript
  2. Basic Active Server Pages Tutorial for beginners
  3. Extremely useful ASP functions
  4. Uploading Files to the Server Hard Disk using plain ASP
  5. Object Oriented Design Principles in Visual Basic
  6. Beginning E-Commerce : Object Oriented Programming
  7. Professional Windows DNA
  8. Create your own Newsletter in ASP 3.0
  9. An ASP Tutorial to create your own Database driven Search Engine
  10. Connections, Commands and Procedures

Comments/Questions ( Threads: 29, Comments: 37 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

  1. getting error while sending email using asp code
  2. auto reply email
  3. Server object error 'ASP 0177 : 800401f3' -- says nitin
  4. i have a problem for sending mail using your asp script ( 1 Reply )
  5. i have a problem for sending mail using your asp script
  6. i have a problem for sending mail using your asp script
  7. i have a problem for sending mail using asp page
  8. Please give me an example of asp program that allow user to save data thru ms access
  9. Sending emails with asp and auto save the data to ms access database
  10. Sending E-Mails with ASP Pages ( sending mail from 64 bit )
  11. iam not getting any error message but at same time mail is not sent
  12. Sending emails with asp pages
  13. Object CDONTF can't work ? ( 1 Reply )
  14. Object CDONTF can't work ?
  15. To mail a web page(asp) filled by the user to a particular id
  16. Question
  17. smtp dont work
  18. End to end request download and send
  19. Want script for insert record in Database from the email
  20. Sending Email on Web ( 1 Reply )
  21. Server object error 'ASP 0177 : 800401f3'
  22. I Using ASPEmail To Send Mail In My Page ( 1 Reply )
  23. Calling A Database Field In A Form
  24. Attaching files from a database ( 1 Reply ) This thread contains 1 reply by Faisal Khan.
  25. asp auto email after a user register to a site ( 1 Reply )
  26. ASP Output as Mail
  27. sendin email
  28. Having problem with sending email
  29. Sending emails with asp pages ( 2 Replies ) This thread contains 1 reply by Faisal Khan.

Post Comments/Questions

In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed.

 
© 1999 - 2010 Stardeveloper.com, All Rights Reserved.