bikebanditcom
Programmer
ok, i have a loan app that im trying to mail using cdo, (its the only option i have with the clients host, using w2003 server, so no cdonts) anyhow, my problem is that i can get the page to send the email, however i dont know how to get all the loan fields into the body of the msg, can anyone help me either loop thru them or tell me how they should be arranged? the following i the code for my page, alot of the fields are missing as im building it as i go because i couldnt get it to work at all with the current page i have, once i have it built i'll move the code to the actual page
thanks
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<!-------------begin form------------>
<%
'Strings for fromaddress, subject, body
Dim FullName, CoApp, StrAdd, City, cState, Zip, EmailAdd
'The CDO object
Dim objCDOMail
'First we'll read in the values entered
strFrom = Request.Form("EmailAdd"
strSubject = "Loan Application"
strBody = Request.Form("FullName, CoApp, StrAdd, City, cState, Zip, "
' Some spacing
strBody = strBody & vbCrLf & vbCrLf
' Initiate Is email valid sub function
If strFrom = "" Or Not IsValidEmail(strFrom) Then
' Create Form
%>
<FORM ACTION="./test_cdo.asp" METHOD="post">
<p>EmailAdd<BR>
<INPUT TYPE="text" NAME="EmailAdd" SIZE="30"></INPUT>
</p>
<p>StrAdd<br>
<INPUT TYPE="text" NAME="StrAdd" SIZE="30">
</p>
<p>City<br>
<INPUT NAME="city" TYPE="text" id="city" SIZE="30">
</p>
<p>Zip<br>
<INPUT NAME="zip" TYPE="text" id="zip" SIZE="30">
<BR>
</p>
<p> Comments:<br>
<TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA>
<BR>
<INPUT TYPE="submit" VALUE="Send Mail"></INPUT>
</p>
</FORM>
<%
Else
' Create an instance of the NewMail object.
Set objMessage = Server.CreateObject("CDO.Message"
' Set the properties of the object
objMessage.From = strFrom
objMessage.To = "danhaydenjr@hotmail.com"
objMessage.Subject = strSubject
objMessage.TextBody = strBody
' Some useful extra variables
objMessage.Bcc = "dhayden@wecantlose.com"
' Send the message!
objMessage.Send
' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objMessage = Nothing
' Set your Response after the Send Mail button is pushed.
Response.Write "Your Message was sent!"
End if
' End page logic
%>
<% ' Only functions and subs follow!
' A quick email syntax checker.
Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = True
If Len(strEmail) < 5 Then
bIsValid = False
Else
If Instr(1, strEmail, " "
<> 0 Then
bIsValid = False
Else
If InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, "."
< InStr(1, strEmail, "@", 1) + 2 Then
bIsValid = False
End If
End If
End If
End If
IsValidEmail = bIsValid
End Function
%>
<!-------------end form------------>
</body>
</html>
thanks
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<!-------------begin form------------>
<%
'Strings for fromaddress, subject, body
Dim FullName, CoApp, StrAdd, City, cState, Zip, EmailAdd
'The CDO object
Dim objCDOMail
'First we'll read in the values entered
strFrom = Request.Form("EmailAdd"
strSubject = "Loan Application"
strBody = Request.Form("FullName, CoApp, StrAdd, City, cState, Zip, "
' Some spacing
strBody = strBody & vbCrLf & vbCrLf
' Initiate Is email valid sub function
If strFrom = "" Or Not IsValidEmail(strFrom) Then
' Create Form
%>
<FORM ACTION="./test_cdo.asp" METHOD="post">
<p>EmailAdd<BR>
<INPUT TYPE="text" NAME="EmailAdd" SIZE="30"></INPUT>
</p>
<p>StrAdd<br>
<INPUT TYPE="text" NAME="StrAdd" SIZE="30">
</p>
<p>City<br>
<INPUT NAME="city" TYPE="text" id="city" SIZE="30">
</p>
<p>Zip<br>
<INPUT NAME="zip" TYPE="text" id="zip" SIZE="30">
<BR>
</p>
<p> Comments:<br>
<TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA>
<BR>
<INPUT TYPE="submit" VALUE="Send Mail"></INPUT>
</p>
</FORM>
<%
Else
' Create an instance of the NewMail object.
Set objMessage = Server.CreateObject("CDO.Message"
' Set the properties of the object
objMessage.From = strFrom
objMessage.To = "danhaydenjr@hotmail.com"
objMessage.Subject = strSubject
objMessage.TextBody = strBody
' Some useful extra variables
objMessage.Bcc = "dhayden@wecantlose.com"
' Send the message!
objMessage.Send
' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objMessage = Nothing
' Set your Response after the Send Mail button is pushed.
Response.Write "Your Message was sent!"
End if
' End page logic
%>
<% ' Only functions and subs follow!
' A quick email syntax checker.
Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = True
If Len(strEmail) < 5 Then
bIsValid = False
Else
If Instr(1, strEmail, " "
bIsValid = False
Else
If InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, "."
bIsValid = False
End If
End If
End If
End If
IsValidEmail = bIsValid
End Function
%>
<!-------------end form------------>
</body>
</html>