ASP – An open application environment, it enables powerful server-side scripting.  Home Web Programming ASP Form Mail via CDOSYS
Your Ad Here

Form Mail via CDOSYS


Form Mail via CDOSYSLearn how to send mail using the power of ASP.

ASP gives you the power to send mail using the "CDOSYS" mail object. This script will send an email from a user to whichever email address you choose. NOTE: this tutorial is for Windows XP/IIS .NET users, please see the tutorial regarding CDONTS for IIS v5 form mail. We will ask three things on the form to keep it simple: their name, their e-mail address, and their comments. This script will either process the email or show the form, depending on whether the "submit" button was pressed:

<%

If request("submit") <> "" THEN
Set objEMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Confi = objConfig.Fields
Confi("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Confi("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:inetpubmailrootpickup"
Confi.Update
Set objEMail.Configuration = objConfig
objEMail.To = "your@emailaddress.com"
objEMail.From = Request("from")
objEMail.Subject = Request("subject")
objEMail.TextBody = Request("message")
objEMail.Send
Set objEMail = Nothing

Response.Write("Message Sent")
Else

%>

<form method="post" action="this.asp">
From Email: <INPUT type=text name="from"><br />
Subject: <INPUT type=text name="subject"><br />
Message: <TEXTAREA name="message" rows=10 cols=40></TEXTAREA><br />
<INPUT type="submit" value="Send" name="submit">
</form>

<%
End If
%>

Not too hard eh?



Author's URL: Wilfried Schobeiri
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Web programming � everything from the basics of visual design and architecture to the specifics of applications, graphics, and scripting. More Web Programming: Most Popular Materials | Fresh Materials | More ASP Tutorials at LearnPHP.org

Add comments to "Form Mail via CDOSYS"

Only registered users can write comment

No comments yet...