View Full Version : I have some code but....

04-12-2006, 05:23 AM
ok every1 i have a little bit of code, which is this

Const cdoSendUsingMethod = _
Const cdoSendUsingPort = 1
Const cdoSMTPServer = _
Const cdoSMTPServerPort = _
Const cdoSMTPConnectionTimeout = _
Const cdoSMTPAuthenticate = _
Const cdoBasic = 1
Const cdoSendUserName = _
Const cdoSendPassword = _

Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mail.covelli.com"
.Item(cdoSMTPServerPort) = 24
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "molly.kinsey@covelli.com"
.Item(cdoSendPassword) = "*******"

End With

Set objMessage = Server.CreateObject("CDO.Message")

Set objMessage.Configuration = objConfig

With objMessage
.To = "chris.galati@covelli.com"
.From = "molly.kinsey@covelli.com"
.Subject = "SMTP Relay Test"
.TextBody = "SMTP Relay Test Sent @ " & Now()
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
response.write "Mail sent successfully"

Response.write("<script language=javascript> window.setTimeout ('window.location=""http://www.panera-tampa.com/index.html""',5000)</script>")

i am trying to make this work with a form that i designed in html, which is hosted here www.panera-tampa.com/application.html I can't figure out how to make this asp file capture the information that is put into the form, then when u hit submit on the form have it email that information. Any help would be appreciated. I would love to talk to any of you on messenger just reply and i'll add you, or you can add me. Thanks for the help

04-12-2006, 08:36 AM
well let's say you're using POST to send data from the form (i.e., <form method="post">), then you set the 'action' to be the name of your email sending script (so <form method="post" action="sendmail(or whatever).asp">). Then you'll have various input fields, looking something like:
<input name="Subject" type="text" size=20 maxlength = 20>
<input name="Body" type="text" size=20 maxlength = 20>

So then, in your ASP script you use Request.Form("Subject") to retrieve the subject from the form. Same deal with "body" etc. Plug those values into the appropriate parts of the script you posted, and bob's your uncle.

Of course, you should validate the form and also output some messages indicating success or otherwise of your script.

Don't want to provide "live support", in any case I'm fairly new to ASP myself, but I hope this explanation is what you were after.