PDA

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



hacker1312001
04-12-2006, 03:51 AM
ok every1 i have a little bit of code, which is this


<%
Const cdoSendUsingMethod = _
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 1
Const cdoSMTPServer = _
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort = _
"http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout = _
"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate = _
"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic = 1
Const cdoSendUserName = _
"http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword = _
"http://schemas.microsoft.com/cdo/configuration/sendpassword"

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) = "*******"

.Update
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()
.Send
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

codeexploiter
05-03-2006, 05:50 AM
Hello hacker1312001,

(1) You need two files:

(a) One interface html file which contains a form through it can accept the values from the user.

(b) Another ASP file that has the code you mentioned in your posting.

(2) The first html file should invoke the second ASP file once the user enter information in the form fields and press submit button. You need a <FORM> tag like the following in your html file.

<FORM name="form1" METHOD="POST" ACTION="email_sending_file.asp">

</FORM>
In between the <FORM> and </FORM> you can place all the form field which you need for your operation. Please remember to give a valid name for each form fields, which is very important.

"email_sending_file.asp" is the one which will accept all the information from the first html files and send email based on that information.

(3) In the "email_sending_file.asp" you can place all the code you mentioned in your posting. Using an ASP object you can access all the values which are coming from the first html file (entered by the user).

Example: If you have a filed whose name is "to_email" then you can extract the value entered in the field using the following method

<%
Dim toValue
toValue = Request.Form("to_email")
%>

(4) In your code you need to change the following section

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

If you look at this piece of code you can find out that all the information furnished above is static. Please have a look at the following example below, I am assuming that you have 4 fields in your html interface form to accept values from the user such as: To Email Address, From Email Address, Subject Field and Body Field

<%
Dim toEmail, fromEmail, subjectVal, bodyText

toEmail = Request.Form("to_email")
fromEmail = Request.Form("from_email")
subjectVal = Request.Form("subject")
bodyText = Request.Form("body")

' If you want you can perform a trim operation to remove leading or trailing spaces.

With objMessage
.To = toEmail
.From = fromEmail
.Subject = subjectVal
.TextBody = bodyText
.Send
End With
'After this continue as you mentioned in your posting
%>

You can refer http://www.w3schools.com/asp/asp_send_email.asp for more details on this topic.

Hope you'll be able to achive the desired results.

Regards

Code Exploiter