View Full Version : Submit page with ASP

01-19-2007, 09:25 PM
I have the following code (at the bottom of the page).... I have several fields, name, address, phone, etc.... listed at the top. I recently had to switch my ASP submit page to send through SMTP, which I didn't have to do before, and now I can't get my fields to go into the message body. I have it written at the bottom "I want my text here"
Can someone please help me, or point me in the right direction, as far as what code I can put there to get those fields into the email it sends? I'm pretty lost.

<%@ Language="VBScript" %>

strFirst=Request.Form("First Name")
strLast=Request.Form("Last Name")
strCompany=Request.Form("Company Name")
strZip=Request.Form("Zip Code")

Const cdoSendUsingPort = 2
Const cdoAnonymous = 0
Const cdoBasic = 1
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

' Set the CDOSYS configuration fields to use port 25 on the SMTP server.

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
' Specify the authentication mechanism to use.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
' The username for authenticating to an SMTP server using basic (clear-text) authentication
' update this with a valid email account from your domain.
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "jon@panniergraphics.com"
' The password used to the email account noted above for sendusername
'Password is Case SensitiVE
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "graphics"
' The port on which the SMTP service specified by the smtpserver field is listening for connections (typically 25)
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
End With

' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "art@pannier.com" 'Enter a valid email address.
.From = "jon@panniergraphics.com" 'Enter a valid email address.
.Subject = "Info From Contact Us Page" 'enter subject
.TextBody = "I want my text here"
'enter message text/body
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

response.redirect "./thanks.asp?Title=contact&Subtitle=thanks"

01-20-2007, 02:48 AM
Here is a ready made script that you can examine and perhaps customize to your liking



01-22-2007, 09:26 PM
I added the script, and it almost works right.
I need to add on there to send through a remote SMTP server... but I can't quite seem to get it to work. I keep getting this error:

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'cdoSendUsingPort'

/mailer.asp, line 48

Any ideas?

01-23-2007, 01:44 PM
Use numeric values instead of the constant values


.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

or set a constant

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

01-23-2007, 08:13 PM
I'm sorry, I really don't understand.
I tried with the numeric values, and I got this error message:

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'Flds'

/mailer.asp, line 48

I don't even know what to do with the constant codes.
I'm a newbie, and really don't understand all of this at all. This is the last .asp page I can't get to work....


01-27-2007, 10:27 AM
if u have to frame an Email u can use the following.

Dim objMsg
set objMsg = Server.CreateObject("CDONTS.NewMail")
objMsg.From = <From mailid>
objMsg.To = <To Mailid>
objMsg.Subject = "Reg:Status of the Product"
objMsg.MailFormat = 0
objMsg.BodyFormat = 0

'Framing contents for body for eg if u r printng Firstname within body then

MailBody = MailBody & strFirst
MailBody = MailBody & strLast

'Like above u can concatenate the contents for the body and pass it as a single variable to objmsg.body.


'Finally in the Mail in Body Part both firstname and Last name will get Printed.
Check with sample and quote whatever necessary .

01-30-2007, 02:00 PM
If you are using Option Explicit then you have to define all used variables in your page.

01-31-2007, 04:29 PM
I cannot figure this out. How can I find somone to freelance this work out to? I also want to change a couple other things, but can't seem to figure it out. I would like to get this stuff done soon... sooner than it will be if I have to figure it out.
Any suggestions?

02-01-2007, 01:18 PM
This forum and Aspfree have forums to request hired help.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum