|
Technical Interview Questions
Visual Basic Interview Question
.NET Web Interview Questions
.NET
Interview Questions
C#
Interview Questions
.........More
Source Codes
Asp .NET Source Codes
Asp VB Script Source Codes
.........More
Soft Skills
Communication Skills
Leadership Skills
.........More
|
|
Asp/VB Script Source Codes
Sending E-Mails with ASP
Pages
Sending an email with asp is fairly easy, all you need is CDONTS (Collaboration
Data Objects for NT Server, installed with IIS), or a special component like
AspEmail ( free ) by Persist Software Inc (there are more available).
<P>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.</P><PRE><%
Option Explicit
Dim objCDOMail
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
%></PRE>
<P>The methods and property's of this object are very obvious.</P><PRE><%
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
%></PRE>
<P>So far it has been pretty easy, hasn't it? There's more.</P><PRE><%
objCDOMail.AttachFile("c:\wwwroot\mysite\" & _
"MyAttachement.doc", "pricelist.doc")
objCDOMail.Bcc("blind@mysite.com")
objCDOMail.Importance = 1
%></PRE>
<UL>
<LI>The first rule defines an attachment ("PATH\TO\FILE", filename_that_appears)
<LI>The second rule sends a blind carbon copy
<LI>The third rule specifies the message's importance<BR> Importance:
<UL type=square>
<LI>0 -> low
<LI>1 -> default
<LI>2 -> high </LI></UL></LI></UL>
<P>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.</P>
<<<----- Return to
Asp/VB Script Source
Code Questions Page.
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Microsoft .Net Interview Questions
for more Microsoft
.Net Interview Questions with Answers.
Check
.Net Database Interview
Questions for more .Net Database Interview Questions with answers
Check
Job Interview Questions
for more Interview Questions with Answers
|