Academic Tutorials



English | French | Portugese | German | Italian
Google

Home Source Codes E-Books Downloads Contact Us About Us

ASP Tutorial
ASP Introduction
Run An ASP Web Page
ASP First Script
ASP Programming-VBScript
Variables in ASP
Array in ASP
Operators in ASP
ASP If Statements
ASP Select Statements
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
Application in ASP
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream
ASP Drive
ASP File
ASP Folder
ASP Dictionary
ASP ADO
ASP Ad Rotator
ASP Browser Cap
ASP Content Linking
ASP Content Rotator
ASP Quick Reference
ASP Summary

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


Sending e-mail with CDOSYS
Previous Next

In ASP, CDOSYS is a built-in component .This component is used to send e-mails .




BEFORE YOU START READ THIS:

In order to send Email from an ASP page on your Web Site, your (Windows / IIS / NT {wossat?}) Web Host needs to have one of the proprietary mailing components installed. Think of these "Components" as "Plug In" programs that add extra functionality to the server. ASK YOUR HOST what they are running and ASK THEM for some working script examples. If they can't provide you with these. Dump them!
 

  • "Can I test my email routines from my own computer?" Probably not. Assuming you are running XP Pro and have IIS 5.1 installed, you would first have to set up and configure the SMTP server and then install and configure any server components that you want to use. Also, the ISP that you use will probably have a policy of not accepting the relay or transfer of mail originating from addresses outside of their own domain. This is a security measure to prevent their servers being used for relaying spam. All in all, it is not an impossible task to set up you own mail server, but it's one that falls way outside of the purpose of this tutorial

  • Basic CDONTS Mailing Script:

    There are eight basic mailing scripts below I have included for you to play with. Each of these scripts uses a different kind of mailing component. THE SCRIPTS WILL ONLY WORK ON A SERVER THAT HAS THE RELEVANT COMPONENT INSTALLED ON IT. Check with your host to find out what they are running. Actually, you should have done that before you signed up with them.

    Use the basic script examples below and get them working properly FIRST before you start messing with forms and thingsOnce you have established what mailing components they have installed,.

    ASP Code:

    <%
    Dim myMail
    Set myMail = Server.CreateObject ("CDONTS.NewMail")
    myMail.From = "You@YourDomain.co.uk"
    myMail.To = "YouAgain@YourOtherAddress.co.uk"
    myMail.Subject = "Test email using CDONTS"
    myMail.Body = "This is a test email message" & vbcrlf & "sent with CDONTS"
    myMail.Send
    set myMail=nothing
    Response.Write("Your e-mail has been sent")
    %>




    How about CDONTs?

    Microsoft has discontinued the use of CDONTs on Windows 2000, Windows XP and Windows 2003. You should update the code and use the new CDO technology,if you have used CDONTs in your ASP applications.

    Sending a text e-mail using a remote server:
    ASP Code:
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="someone@somedomain.com"
    myMail.TextBody="This is a message."
    myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
    'Name or IP of remote SMTP server
    myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _ ="smtp.server.com"
    'Server port
    myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _ =25
    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail=nothing
    %>



    Sending a text e-mail with Bcc and CC fields:
    ASP Code:
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="someone@somedomain.com"
    myMail.Bcc="someoneelse@somedomain.com"
    myMail.Cc="someoneelse2@somedomain.com"
    myMail.TextBody="This is a message."
    myMail.Send
    set myMail=nothing
    %>
    Sending an HTML e-mail that sends a webpage from a website:
    ASP Code:
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="someone@somedomain.com"
    myMail.CreateMHTMLBody "http://www.academictutorials.com/asp/"
    myMail.Send
    set myMail=nothing
    %>
    Sending an HTML e-mail that sends a webpage from a file on your computer:
    ASP Code:
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="someone@somedomain.com"
    myMail.CreateMHTMLBody "file://c:/mydocuments/test.htm"
    myMail.Send
    set myMail=nothing
    %>



    Sending an HTML e-mail:
    ASP Code:
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="someone@somedomain.com"
    myMail.HTMLBody = "<h1>This is a message.</h1>"
    myMail.Send
    set myMail=nothing
    %>
    Sending a text e-mail with an Attachment:
    ASP Code:
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="someone@somedomain.com"
    myMail.TextBody="This is a message."
    myMail.AddAttachment "c:\mydocuments\test.txt"
    myMail.Send
    set myMail=nothing
    %>



    Basic ASPMail Mailing Script:
    ASP Code:
    <%
    Dim MyMail
    Set MyMail = Server.CreateObject("SMTPsvg.Mailer")
    MyMail.FromName = "Fred Bloggs"
    MyMail.FromAddress= "You@YourAddress.co.uk"
    MyMail.RemoteHost = "mail.yourdomain.co.uk"
    MyMail.AddRecipient= "Joe Bloggs ", "YouAgain@YourOtherAddress.co.uk"
    MyMail.Subject = "Test email using ASPMail"
    MyMail.BodyText = "This is a test email message" & vbcrlf &"sent with ASPMail"
    MyMail.SendMail
    Set MyMail = nothing
    Response.Write("Your e-mail has been sent")
    %>



    Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
    • blinkbits
    • BlinkList
    • blogmarks
    • co.mments
    • connotea
    • del.icio.us
    • De.lirio.us
    • digg
    • Fark
    • feedmelinks
    • Furl
    • LinkaGoGo
    • Ma.gnolia
    • NewsVine
    • Netvouz
    • RawSugar
    • Reddit
    • scuttle
    • Shadows
    • Simpy
    • Smarking
    • Spurl
    • TailRank
    • Wists
    • YahooMyWeb

    Previous Next

    Keywords: cdonts component, cdonts dim, active server pages, cdonts recipients


    HTML Quizes
    HTML Quiz
    XHTML Quiz
    CSS Quiz
    TCP/IP Quiz
    XML Quizes
    XML Quiz
    XSL Quiz
    XSLT Quiz
    DTD Quiz
    Schema Quiz
    XForms Quiz
    XSL-FO Quiz
    XML DOM Quiz
    XLink Quiz
    XQuery Quiz
    XPath Quiz
    XPointer Quiz
    RDF Quiz
    SOAP Quiz
    WSDL Quiz
    RSS Quiz
    WAP Quiz
    Web Services Quiz
    Browser Scripting Quizes
    JavaScript Quiz
    VBScript Quiz
    AJAX Quiz
    DHTML Quiz
    HTML DOM Quiz
    WMLScript Quiz
    E4X Quiz
    Server Scripting Quizes
    ASP Quiz
    PHP Quiz
    PERL Quiz
    SQL Quiz
    ADO Quiz
    .NET (dotnet) Quizes
    Microsoft.Net Quiz
    XML Web Services Quiz
    ASP.Net Quiz
    .Net Mobile Quiz
    C# : C Sharp Quiz
    ADO.NET Quiz
    VB.NET Quiz
    Multimedia Quizes
    SVG Quiz
    Flash Quiz
    Media Quiz
    SMIL Quiz
    Web Building  Quizes
    Web Browsers Quiz
    Web Hosting Quiz
    W3C Quiz
    Web Building Quiz
    Web Quality Quiz
    Web Semantic Quiz
    Web Careers Quiz
    Java Quizes
    Java Quiz
    JSP Quiz
    Servlets Quiz
    Struts Quiz
    EJB Quiz
    JMS Quiz
    JMX Quiz
    Programming Langauges Quizes
    C Quiz
    C++ Quiz
    Visual Basic Quiz
    Data Structures Using C Quiz
    Soft Skills Quizes
    Communication Skills Quiz
    Time Management Quiz
    Project Management Quiz
    Team Work Quiz
    Leadership Skills Quiz
    Corporate Communication Quiz
    Negotiation Skills Quiz

    Privacy Policy
    Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.