PDA

View Full Version : Sending Mail Using CDONTS


admin
05-28-2003, 11:41 PM
<%
Dim strTo, strSubject, strBody
'strings for recipient, subject, and body

Dim objCDOMail
'CDO object

strTo = Request.Form("to")
'reads in the entered values

strSubject = "Whatever you want to name it"
strBody = "Just Testing..."

If strTo = "" Then
%>

<Form Action="email_cdo.asp" Method="post">
Enter your email address:<br>
<Input Type="text" Name="to" Size="30">
<Input Type="submit" Value="Send Mail">
</Form>

<%
Else

Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = "email address"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Send
Set objCDOMail = Nothing

End If
%>