Chamark
12-20-2006, 06:19 AM
I have a form that the user fills out and I want to send an email when the user clicks the submit button. How would I incorporate the following code to only send when the submit button is clicked? Thanks in advance for any help!!
<body>
<%
Dim objNewMail
Set objNewMail = CreateObject("CDO.Message")
With ObjNewMail
'This section provides the configuration information for the remote SMTP server.
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="10.14.83.20"
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Configuration.Fields.Update
'End remote SMTP server configuration section==
.From = "me@myserver.com"
.To = "you@yourserver.com"
.Subject = "Test Email"
.HTMLBody = "this is a test"
.Send
End With
set objNewMail = Nothing
%>
</body>
<body>
<%
Dim objNewMail
Set objNewMail = CreateObject("CDO.Message")
With ObjNewMail
'This section provides the configuration information for the remote SMTP server.
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="10.14.83.20"
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Configuration.Fields.Update
'End remote SMTP server configuration section==
.From = "me@myserver.com"
.To = "you@yourserver.com"
.Subject = "Test Email"
.HTMLBody = "this is a test"
.Send
End With
set objNewMail = Nothing
%>
</body>