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"
%>
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"
%>