...

View Full Version : Submit page with ASP



jonkovach
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.
Thanks,
Jon



<%@ Language="VBScript" %>

<%
strFirst=Request.Form("First Name")
strLast=Request.Form("Last Name")
strCompany=Request.Form("Company Name")
strAddress=Request.Form("Address")
strAddress2=Request.Form("address2")
strCity=Request.Form("City")
strState=Request.Form("State")
strZip=Request.Form("Zip Code")
strCountry=Request.Form("country")
strPhone=Request.Form("phone")
strFax=Request.Form("fax")
strEmail=Request.Form("Email")
strComments=Request.Form("comments")
strTitle=Request.Form("Title")

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
.Update
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
.Send
End With

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

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

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

http://www.codeproject.com/asp/sendmail.asp

Cheers,
Ess

jonkovach
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?
Jon

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

e.g.


.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

jonkovach
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....

Jon

dev
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.

objMsg.Body=MailBody
objMsg.send

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

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

jonkovach
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?
Thanks,
Jon

degsy
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