Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with cdo

Status
Not open for further replies.

bikebanditcom

Programmer
Jun 11, 2003
117
US
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=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</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(&quot;EmailAdd&quot;)

strSubject = &quot;Loan Application&quot;
strBody = Request.Form(&quot;FullName, CoApp, StrAdd, City, cState, Zip, &quot;)

' Some spacing
strBody = strBody & vbCrLf & vbCrLf

' Initiate Is email valid sub function
If strFrom = &quot;&quot; Or Not IsValidEmail(strFrom) Then

' Create Form
%>
<FORM ACTION=&quot;./test_cdo.asp&quot; METHOD=&quot;post&quot;>

<p>EmailAdd<BR>
<INPUT TYPE=&quot;text&quot; NAME=&quot;EmailAdd&quot; SIZE=&quot;30&quot;></INPUT>
</p>
<p>StrAdd<br>
<INPUT TYPE=&quot;text&quot; NAME=&quot;StrAdd&quot; SIZE=&quot;30&quot;>
</p>
<p>City<br>
<INPUT NAME=&quot;city&quot; TYPE=&quot;text&quot; id=&quot;city&quot; SIZE=&quot;30&quot;>
</p>
<p>Zip<br>
<INPUT NAME=&quot;zip&quot; TYPE=&quot;text&quot; id=&quot;zip&quot; SIZE=&quot;30&quot;>
<BR>
</p>
<p> Comments:<br>
<TEXTAREA NAME=&quot;body&quot; ROWS=&quot;10&quot; COLS=&quot;40&quot; WRAP=&quot;virtual&quot;></TEXTAREA>
<BR>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send Mail&quot;></INPUT>
</p>
</FORM>
<%
Else
' Create an instance of the NewMail object.
Set objMessage = Server.CreateObject(&quot;CDO.Message&quot;)

' Set the properties of the object
objMessage.From = strFrom
objMessage.To = &quot;danhaydenjr@hotmail.com&quot;
objMessage.Subject = strSubject
objMessage.TextBody = strBody

' Some useful extra variables
objMessage.Bcc = &quot;dhayden@wecantlose.com&quot;

' 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 &quot;Your Message was sent!&quot;

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, &quot; &quot;) <> 0 Then
bIsValid = False
Else
If InStr(1, strEmail, &quot;@&quot;, 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, &quot;.&quot;) < InStr(1, strEmail, &quot;@&quot;, 1) + 2 Then
bIsValid = False
End If
End If
End If
End If

IsValidEmail = bIsValid
End Function
%>

<!-------------end form------------>
</body>
</html>
 
does the page display any error? are u(the server) connected to the net?

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top