Article ID: 186204
Article Last Modified on 4/28/2005
objNewMail.Send([From][, To][, Subject][, Body][, Importance] )
objNewMail
Required. This NewMail object.
From
Optional. String. The full messaging address to be identified as
the sender (for example, someone@Microsoft.com)
To
Optional. String. A list of full messaging addresses of recipients.
The individual recipient addresses are separated by semicolons.
(for example, someone@Microsoft.com)
Subject
Optional. String. The subject line for the message.
Body
Optional. IStream object or String. The text of the message. Only
C/C++ and Java programs can use an IStream object for the Body
parameter. They should pass an IUnknown object that returns an
IStream interface in response to QueryInterface. Microsoft Visual
Basic supports the IDispatch interface and not IUnknown, so it
cannot use an IStream object.
Importance
Optional. Long. The importance associated with the message, High,
Normal or Low. This article sets the required value depending upon
which option button the user selects.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR"
content="Microsoft FrontPage (Visual InterDev Edition) 2.0">
<title>CDONTSMail</title>
</head>
<body bgcolor="#FFFFFF">
<form action="CDONTSMail.asp" method="POST">
<table border="0">
<tr>
<td>From:</td>
<td><!--webbot bot="Validation"
b-value-required="TRUE" --><input type="text"
size="47" name="txtFrom"
value="Your internet address (Me@MyCompany.com)"></td>
</tr>
<tr>
<td>To:</td>
<td><!--webbot bot="Validation"
b-value-required="TRUE" --><input type="text"
size="47" name="txtTo"
value="The recipient's address (You@YourCompany.com)"></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type="text" size="47" name="txtSubject"
value="Enter a subject here"></td>
</tr>
<tr>
<td valign="top">Message:</td>
<td><textarea name="txtMessage" rows="9" cols="45">
Type your message here.</textarea></td>
</tr>
<tr>
<td valign="top">Importance:</td>
<td><input type="radio" name="optImportance"
value="2">High<br>
<input type="radio" checked name="optImportance"
value="1">Normal<br>
<input type="radio" name="optImportance" value="0">Low<br>
</td>
</tr>
</table>
<p><input type="submit" name="cmdSubmit" value="Submit">
<input type="reset" name="cmdClear" value="Clear"> </p>
</form>
</body>
</html>
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type"
content="text/html;charset=iso-8859-1">
<TITLE>CDONTSMail</TITLE>
<%
Sub Write(strWriteThis)
'This subroutine just writes out whatever is
'passed to it.
response.write(strWriteThis & "<br>")
end sub
%>
</HEAD>
<BODY>
<%
Dim myCDONTSMail
Dim strFrom
Dim strTo
Dim strSubject
Dim strMessage
Dim lngImportance
'The following variable assignments are not required
'they are just here to make interpretation of the
'myCDONTSMail.Send line easier. You could put the
'Request.Form statements in the .Send line to cut down
'on the amount of code in the file.
strFrom=request.form("txtFrom")
strTo=request.form("txtTo")
strSubject = request.form("txtSubject")
strBody=request.form("txtMessage")
lngImportance = request.form("optImportance")
'The following four lines of code are just here for test
'purposes to see what variables have been pulled in from the
'HTM form.
Write("strFrom = " & strFrom)
Write("strTo = " & strTo)
Write("strSubject = " & strSubject)
Write("strMessage = " & strBody)
Write("Importance = " & lngImportance)
Set myCDONTSMail = CreateObject("CDONTS.NewMail")
myCDONTSMail.Send strFrom,strTo,strSubject,strBody,lngImportance
Set myCDONTSMail = Nothing
Write "Mail has been sent."
%>
</BODY>
</HTML>
NOTE: The NewMail object becomes invalid upon successful completion of
the Send method, and you cannot reuse it for another message. You
should Set it to Nothing to release the memory. Attempted access
to a sent NewMail object results in a return of
CdoE_INVALID_OBJECT.
Additional query words: kbDSupport kbCDONTS kbdse
Keywords: kbhowto kbmsg kbhtml KB186204