ASP Email

This is a discussion on "ASP Email" within the Classic ASP section. This forum, and the thread "ASP Email are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Aug 19th, 2003, 13:34
Junior Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
ASP Email

<%


Response.Buffer = true
Function BuildUpload(RequestBin)

PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,RequestBin,boundary)

Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
Pos = InstrB(BoundaryPos,RequestBin,getByteString("Conte nt-Disposition"))
Pos = InstrB(Pos,RequestBin,getByteString("name="))
PosBeg = Pos+6
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filen ame="))
PosBound = InstrB(PosEnd,RequestBin,boundary)

If PosFile<>0 AND (PosFile<PosBound) Then

PosBeg = PosFile + 10
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "FileName", FileName
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
PosBeg = Pos+14
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "ContentType",ContentType

PosBeg = PosEnd+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)

Else

Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg = Pos+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))

End If

UploadControl.Add "Value" , Value
UploadRequest.Add name, UploadControl
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),Requ estBin,boundary)
Loop

End Function

Function getByteString(StringStr)
For i = 1 to Len(StringStr)

char = Mid(StringStr,i,1)
getByteString = getByteString & chrB(AscB(char))

Next
End Function


Function getString(StringBin)
getString =""
For intCount = 1 to LenB(StringBin)
getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next
End Function


If request("Action")="1" then

Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUpload(RequestBin)

'Create the file, change the path to the path U use for temp storage of the file
'make sure you have the IUSR_YOURCOMPUTER granted WRITE access to the uploads dir

If UploadRequest.Item("blob").Item("Value") <> "" Then

contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
FolderName = UploadRequest.Item("where").Item("Value")
Path = Mid(Request.ServerVariables("PATH_TRANSLATED"), 1, Len(Request.ServerVariables("PATH_TRANSLATED")) - Len(Request.ServerVariables("PATH_INFO")))
ToFolder = Path & "\" & FolderName
value = UploadRequest.Item("blob").Item("Value")
filename = ToFolder & "\" & filename
Set MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = MyFileObject.CreateTextFile(filename)

For i = 1 to LenB(value)

objFile.Write chr(AscB(MidB(value,i,1)))

Next
objFile.Close
Set objFile = Nothing
Set MyFileObject = Nothing

End If
Title = UploadRequest.Item("Title").Item("Value")
FirstName = UploadRequest.Item("First_Name").Item("Value")
LastName = UploadRequest.Item("Last_Name").Item("Value")
Building_No_Name = UploadRequest.Item("Building_No_Name").Item("Value ")
Street = UploadRequest.Item("Street").Item("Value")
Town = UploadRequest.Item("Town").Item("Value")
County = UploadRequest.Item("County").Item("Value")
Postcode = UploadRequest.Item("Postcode").Item("Value")
Telephone_Number = UploadRequest.Item("Telephone_Number").Item("Value ")
Mobile_Number = UploadRequest.Item("Mobile_Number").Item("Value")
Work_Number = UploadRequest.Item("Work_Number").Item("Value")
Email_Address = UploadRequest.Item("Email_Address").Item("Value")
Sector = UploadRequest.Item("Sector").Item("Value")
Set UploadRequest = Nothing

body="<html><body><p align='center'><font size='5' face='Times New Roman' color='#0000FF'>Resume Details </font></p>"
body=body & "<table align='center'> <tr><td><font size='3' face='Times New Roman' color='#660033'>Post Applied for </td><td><font size='3' face='Times New Roman' color='#660033'>" & jobcode & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Name </td><td><font size='3' face='Times New Roman' color='#660033'>" & MyName & "</td></tr>"
body=body & "<tr><td><font size='3' face='Times New Roman' color='#660033'>Current Position </td><td><font size='3' face='Times New Roman' color='#660033'>" & MyPosition & "</td></tr>"
body=body & "<tr><td><font size='3' face='Times New Roman' color='#660033'>Other Info </td><td><font size='3' face='Verdana' color='#0000FF'>" & MyText & "</td></tr>"
body = body & "</table></body></html>"


Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
ObjCDOMail.From = MyEmailid
ObjCDOMail.To = "steve.owens@rslsteeper.com"
ObjCDOMail.BodyFormat = 0
ObjCDOmail.Mailformat = 0
ObjCDOMail.Subject = "Candidate Registration Form" & MyPosition
ObjCDOMail.Body = body

If Len(filename) > 5 then

ObjCDOMail.AttachFile filename,nikfile


end if

ObjCDOMail.Send
Set ObjCDOMail = Nothing

' Now the file in the uploads dir can be deleted

Set fso = CreateObject("Scripting.FileSystemObject")

fso.DeleteFile filename
set fso = nothing

End If

%>
<html>
<script language='javascript'>
alert("Thank You for Registering Yor Resume");
location.replace("cvupload2.htm");
</script>
</html>


can you check that what i have done will work
because it does not seem to for some reason
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Aug 19th, 2003, 15:37
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
server.CreateObject("CDNOTS.NewMail")

should be:

server.CreateObject("CDONTS.NewMail")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Aug 19th, 2003, 20:45
New Member
Join Date: Aug 2003
Location: USA
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Maybe I am being anal; however, line 1:

<%@ Language=VBScript %>

The CDONTS typo has already been addressed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Aug 19th, 2003, 20:59
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
I'm not sure of your meaning here Savannah...
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Aug 21st, 2003, 10:01
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
ok...
for this you need two files...

Obviously the form itself... I can only guess what fields you want on the form, so here is one I borrowed from the web (cvupload.htm):-
Code: Select all
<textarea cols=90 rows=30><html>
<head>
<title>Upload your resume using this form </title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="8">
<form METHOD="POST" ENCTYPE="multipart/form-data" action="cvupload.asp?ACTION=1" name="mailform" id="mailform">
  <table border="1" align="center" width="625" bgcolor="#CCCCCC" bordercolor="#660033">
    <tr bordercolor="#FFFFFF"> 
      <td width="123"></td>
      <td width="486"></td>
    </tr>
    <tr bordercolor="#FFFFFF"> 
      <td valign="top" colspan="2" class="text"> 
        <h4 align="center"><font color="#660033"><u>Upload Resume</u></font></h4>
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td class="text" align="left"><font color="#0000FF">E-mail Id</font></td>
      <td valign="top" class="text" align="right"> 
        <div align="left"> 
          <input class="text" type=text name=MyEmailid size="35">
        </div>
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td class="text" align="left"><font color="#0000FF">Name</font></td>
      <td valign="top" align="right"> 
        <div align="left"> 
          <input class="text" name="MyName" size="35">
        </div>
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td class="text" align="left"><font color="#0000FF">Position</font></td>
      <td valign="top" align="right"> 
        <div align="left"> 
          <select size="1" name=MyPosition>
            <option value="None">None</option>
            <option value="Analyst / Consultant">Analyst / Consultant</option>
            <option value="Business Development Manager">Business Development 
            Manager</option>
            <option value="Bank Officer">Bank Officer</option>
            <option value="CEO/Chairman">CEO / Chairman</option>
            <option value="Company Secretary">Company Secretary</option>
            <option value="Customer Service Executive">Customer Service Executive</option>
            <option value="Engineer">Engineer</option>
            <option value="Editor / Journalist / Writer">Editor / Journalist / 
            Writer</option>
            <option value="Finance Controller / Executive">Finance Controller 
            / Finance Executive</option>
            <option value="Fresher">Fresher</option>
            <option value="Freelancer">Freelancer</option>
            <option value="General Manager / Director">General Manager / Director</option>
            <option value="Graphic Artist / Multimedia Programmer">Graphic Artist 
            / Multimedia Programmer</option>
            <option value="Human Resources Executive">Human Resources Executive</option>
            <option value="House Wife">House Wife</option>
            <option value="Internet Programmer / Web Designer">Internet Programmer 
            / Web Designer </option>
            <option value="Marketing / Sales - Manager">Marketing Manager (inc. 
            Sales)</option>
            <option value="Marketing / Sales - Exec">Marketing / Sales Executive</option>
            <option value="Medical Transcriptionist">Medical Transcriptionist</option>
            <option value="Office Assistant">Office Assistant</option>
            <option value="Purchasing Manager">Purchasing Manager</option>
            <option value="Software Programmer">Software Programmer</option>
            <option value="Technical / IT Manager">Technical / IT Manager</option>
            <option value="Technician">Technician</option>
            <option value="Team Leader">Team Leader</option>
            <option value="Student">Student</option>
            <option value="Other">Other</option>
          </select>
        </div>
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td valign="middle" class="text">JobCode </td>
      <td valign="middle"> 
        <input type="text" name="jobcode" class="mystyle1" maxlength="8" size="9">
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td valign="top"><font color="#660033">Any Other Info</font></td>
      <td valign="middle" class="text" align="right"> 
        <div align="left"> 
          <textarea class="text" rows="4" name="MyText" wrap="VIRTUAL" cols="35"></textarea>
          ( max 50 Words) </div>
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td valign="middle"> 
        

</p>
      </td>
      <td valign="top" class="text" align="right"> 
        <div align="left"> </div>
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td colspan="2" valign="top" class="text" align="center"> 
        <div align="left"><font color="#0000FF">Attach Resume:</font> 
          <input TYPE="file" NAME="blob" value>
          <input TYPE="HIDDEN" NAME="where" value="Fileupload">
          
        </div>
      </td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td></td>
      <td></td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td colspan="2" valign="top" class="text"><font color="#660033">Click 
        <input class="text" type="submit" value="Submit" id=submit1 name=submit1>
        only once Pls !</font></td>
    </tr>
    <tr bordercolor="#CCCCCC"> 
      <td colspan="2" valign="top" class="text"> 
        <div align="right"><font color="#660033"> <font size="2"><font size="1"> 
          <span style='font-family:Arial'>CLOSE THIS WINDOW </span></font></font></font></div>
      </td>
    </tr>
  </table>
</form> 
</body>
</html></textarea>
Next, you will need something to handle the upload of the attachment, and to put the email together.

Call this one cvupload.asp

Code: Select all
<textarea cols=90 rows=30>
<%


   Response.Buffer = true
   Function BuildUpload(RequestBin) 

   PosBeg = 1
   PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13))) 
   boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg) 
   boundaryPos = InstrB(1,RequestBin,boundary) 

   Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
   Dim UploadControl
   Set UploadControl = CreateObject("Scripting.Dictionary") 
   Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition")) 
   Pos = InstrB(Pos,RequestBin,getByteString("name=")) 
   PosBeg = Pos+6 
   PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34))) 
   Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg)) 
   PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename=")) 
   PosBound = InstrB(PosEnd,RequestBin,boundary) 
    
   If PosFile<>0 AND (PosFile<PosBound) Then 

        PosBeg = PosFile + 10
        PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34))) 
        FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg)) 
        UploadControl.Add "FileName", FileName 
        Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:")) 
        PosBeg = Pos+14 
        PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13))) 
        ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg)) 
        UploadControl.Add "ContentType",ContentType 

        PosBeg = PosEnd+4 
        PosEnd = InstrB(PosBeg,RequestBin,boundary)-2 
        Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg) 

   Else
 
        Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
        PosBeg = Pos+4 
        PosEnd = InstrB(PosBeg,RequestBin,boundary)-2 
        Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg)) 

   End If

        UploadControl.Add "Value" , Value
        UploadRequest.Add name, UploadControl 
        BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary) 
        Loop 

   End Function

   Function getByteString(StringStr)
   For i = 1 to Len(StringStr) 

        char = Mid(StringStr,i,1)
        getByteString = getByteString & chrB(AscB(char)) 

   Next
   End Function


   Function getString(StringBin)
        getString ="" 
   For intCount = 1 to LenB(StringBin) 
        getString = getString & chr(AscB(MidB(StringBin,intCount,1))) 
   Next 
   End Function


   If request("Action")="1" then

        Response.Clear
        byteCount = Request.TotalBytes 
        RequestBin = Request.BinaryRead(byteCount) 
        Set UploadRequest = CreateObject("Scripting.Dictionary") 
        BuildUpload(RequestBin) 
		
		'Create the file, change the path to the path U use for temp storage of the file
		'make sure you have the IUSR_YOURCOMPUTER granted WRITE access to the uploads dir

   If UploadRequest.Item("blob").Item("Value") <> "" Then 

        contentType = UploadRequest.Item("blob").Item("ContentType")
        filepathname = UploadRequest.Item("blob").Item("FileName") 
        filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\")) 
        FolderName = UploadRequest.Item("where").Item("Value") 
        Path = Mid(Request.ServerVariables("PATH_TRANSLATED"), 1, Len(Request.ServerVariables("PATH_TRANSLATED")) - Len(Request.ServerVariables("PATH_INFO")))  
        ToFolder = Path & "\" & FolderName
        value = UploadRequest.Item("blob").Item("Value") 
        filename = ToFolder & "\" & filename
        Set MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
        Set objFile = MyFileObject.CreateTextFile(filename)
 
   For i = 1 to LenB(value)

       objFile.Write chr(AscB(MidB(value,i,1)))

   Next
       objFile.Close
       Set objFile = Nothing 
       Set MyFileObject = Nothing 

   End If
	   jobcode = UploadRequest.Item("jobcode").Item("Value")
	   MyPosition = UploadRequest.Item("MyPosition").Item("Value")
       MyText = UploadRequest.Item("MyText").Item("Value") 
       MyEmailid = UploadRequest.Item("MyEmailid").Item("Value") 
	   MyName = UploadRequest.Item("MyName").Item("Value")
       Set UploadRequest = Nothing     
	   
	 body="<html><body><p align='center'><font size='5' face='Times New Roman' color='#0000FF'>Resume Details </font></p>"
	body=body & "<table align='center'>	<tr><td><font size='3' face='Times New Roman' color='#660033'>Post Applied for</td><td><font size='3' face='Times New Roman' color='#660033'>" & jobcode & "</td></tr>" 
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Name</td><td><font size='3' face='Times New Roman' color='#660033'>" & MyName & "</td></tr>"
body=body & "<tr><td><font size='3' face='Times New Roman' color='#660033'>Current Position</td><td><font size='3' face='Times New Roman' color='#660033'>" & MyPosition & "</td></tr>"
body=body & "<tr><td><font size='3' face='Times New Roman' color='#660033'>Other Info</td><td><font size='3' face='Verdana' color='#0000FF'>" & MyText & "</td></tr>"
body = body & "</table></body></html>"

		
       Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
       ObjCDOMail.From = MyEmailid 
       ObjCDOMail.To = "the mail id you want the message to be sent"
       ObjCDOMail.BodyFormat = 0 
       ObjCDOmail.Mailformat = 0 
       ObjCDOMail.Subject = "Application from a  " & MyPosition 
       ObjCDOMail.Body = body 

   If Len(filename) > 5 then

      ObjCDOMail.AttachFile filename,nikfile
   

   end if

       ObjCDOMail.Send
       Set ObjCDOMail = Nothing 
	   
	   ' Now the file in the uploads dir can be deleted
	  
	  		Set fso = CreateObject("Scripting.FileSystemObject")
            
					fso.DeleteFile filename
        set fso = nothing
	  
   End If
   
 %>
<html>
<script language='javascript'>
alert("Thank You for Registering Yor Resume");
location.replace("cvupload2.htm");
</script>
</html></textarea>
and that, I guess is what you want!!

You will of course have to modify it to fit in with your own form, but this will give you the general idea!!!
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Aug 21st, 2003, 11:27
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
DJ....

You appear to have edited your initial post.... now the replys dont really make that much sense....


Could you in future just reply to the topic, then we can all follow the thread logically.

I'll look over the code now.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Aug 21st, 2003, 11:32
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
The problem you are having is that you have not edited the email sending process...

MyEmailid needs to be changed to the variable that is assigned the email address field of the candidate.

Also, you will need to change where the body is built up to incorporate your own fields... rather than the example I sent you.

Hope this helps.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Aug 21st, 2003, 13:42
Junior Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Right i have just about had enough of ASP now.

Here are my form and the asp script they are running at

http://www.zrconsultants.co.uk/candi...istration.html

<------Form----->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Register Your CV</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language=JavaScript src="Scripts/scroll.js" type=text/javascript></script>
</head>

<body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<div align="left">
<script language=JavaScript src="Scripts/ZR_Menu.js" type=text/javascript></script>
<script language=JavaScript src="Scripts/mmenu.js" type=text/javascript></script>
</div>
<table width="780" border="0" cellpadding="0" cellspacing="0">

<tr>
<td height="110" colspan="3" align="center" valign="middle">[img]images/Banner.jpg[/img]</td>
</tr>
<tr>
<td width="9" rowspan="5" valign="top" bgcolor="#000033"></td>
<td width="762" height="37" valign="top"><font color="#000066" size="2" face="Verdana">Candidate
Registration Form:</font>
<hr></td>
<td width="9" rowspan="5" valign="top" bgcolor="#000033"></td>
</tr>
<tr>
<td height="14"></td>
</tr>
<tr>
<td height="43" align="center" valign="top">

<font color="#000066" size="2"><font size="1" face="Verdana">To
register with ZR Consultants Ltd and receive regular job updates please
complete the below registration form.</font>
</font></p>


<font size="1" face="Verdana"><font color="#000066">We will then
store your details and inform you of new vacancies as soon as they become
available.</font>
</font></p></td>
</tr>
<tr>
<td height="32"></td>
</tr>
<tr>
<td height="464" align="center" valign="middle"> <form METHOD="POST" ENCTYPE="multipart/form-data" action="cvupload.asp" name="mailform" id="mailform">
<input TYPE="HIDDEN" NAME="where" value="Fileupload">
<table>

<tr>
<td width="158" ALIGN="right"><font color="#000066" size="1" face="Arial">Title</font></td>
<td width="242"><font face="Arial">
<select name="Title" id="Title">
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Ms">Ms</option>
<option value="Doctor">Doctor</option>
<option value="Sir">Sir</option>
</select>
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">First
Name
</font></td>
<td><font face="Arial">
<input NAME="First_Name" TYPE="TEXT" id="First_Name" SIZE="25">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Last
Name
</font></td>
<td><font face="Arial">
<input NAME="Last_Name" TYPE="TEXT" id="Last_Name" SIZE="25">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Building
Name/No.</font>
</td>
<td><font face="Arial" color="#C0C0C0">
<input NAME="Building_No_Name" TYPE="TEXT" id="Building_No_Name" SIZE="35">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Street</font></td>
<td><font face="Arial">
<input NAME="Street" TYPE="TEXT" id="Street" SIZE="35">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Town</font></td>
<td><font face="Arial">
<input NAME="Town" TYPE="TEXT" id="Town" SIZE="35">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">County</font></td>
<td><font face="Arial">
<input NAME="County" TYPE="TEXT" id="County" SIZE="35">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Postcode</font></td>
<td><font face="Arial">
<input NAME="Postcode" TYPE="TEXT" id="Postcode" SIZE="12" MAXLENGTH="12">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Telephone
Number
</font></td>
<td><font face="Arial">
<input NAME="Telephone_Number" TYPE="TEXT" id="Telephone_Number" SIZE="25">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Mobile
number
</font></td>
<td><font face="Arial">
<input NAME="Mobile_Number" TYPE="TEXT" id="Mobile_Number" SIZE="25" MAXLENGTH="25">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Work
number ( Discretion Assured)
</font></td>
<td><font face="Arial">
<input NAME="Work_Number" TYPE="TEXT" id="Work_Number" SIZE="25" MAXLENGTH="25">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">E-mail
Address
</font></td>
<td><font face="Arial">
<input NAME="Email_Address" TYPE="TEXT" id="Email_Address" SIZE="40">
</font></td>
</tr>
<tr>
<td ALIGN="right"><font color="#000066" size="1" face="Arial">Please
Attach Your CV here
</font></td>
<td valign="middle" nowrap><font face="Arial">
<input name="CV" type="file" id="CV">
</font></td>
</tr>
<tr>
<td height="26" ALIGN="right" valign="top"><font color="#000066" size="1" face="Arial">Sector</font></td>
<td valign="top"><font face="Arial">
<select name="Sector" id="Sector">
<option value="Accountancy">Accountancy</option>
<option value="Admin/Secretarila">Admin/Secretarila</option>
<option value="Banking">Banking</option>
<option value="Catering/Hospitality">Catering/Hospitality</option>
<option value="Creative/Media">Creative/Media</option>
<option value="Customer Services">Customer Services</option>
<option value="Education">Education</option>
<option value="Enigineering">Enigineering</option>
<option value="Financial Services">Financial Services</option>
<option value="General Insurance">General Insurance</option>
<option value="Health/Medical">Health/Medical</option>
<option value="HR/Training">HR/Training</option>
<option value="IT">IT</option>
<option value="Legal">Legal</option>
<option value="Leisure/Tourism">Leisure/Tourism</option>
<option value="Manufacturing/Production">Manufacturing/Production</option>
<option value="Marketing/Advertising">Marketing/Advertising</option>
<option value="Purchasing">Purchasing</option>
<option value="Recruitment Consultant">Recruitment Consultant</option>
<option value="Retail">Retail</option>
<option value="Sales">Sales</option>
<option value="Scientific Research">Scientific Research</option>
<option value="Social Care/Services">Social Care/Services</option>
<option value="Telecoms/Datacoms">Telecoms/Datacoms</option>
<option value="Transport/Logistics">Transport/Logistics</option>
<option value="Warehouse/Industrial">Warehouse/Industrial</option>
<option>Other</option>
</select>
</font></td>
</tr>
<tr>
<td height="21"></td>
<td></td>
</tr>
</table>
<p align="center"><font color="#C0C0C0">
<input TYPE="submit" VALUE="Send" name="Send">

<input TYPE="reset" VALUE="Reset" name="Reset">
</font></p>
</form></td>
</tr>
<tr>
<td height="20" colspan="3" align="center" valign="middle" bgcolor="#000033"><font color="#FFFFFF" size="1.5" face="Verdana">Home</font><font color="#FFFFFF" size="1.5" face="Verdana">:Terms
:E-mail</font></td>
</tr>
</table>
<div align="left"></div>
</body>
</html>



<-----ASP Email Script------>

<%


Response.Buffer = true
Function BuildUpload(RequestBin)

PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,RequestBin,boundary)

Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
Pos = InstrB(BoundaryPos,RequestBin,getByteString("Conte nt-Disposition"))
Pos = InstrB(Pos,RequestBin,getByteString("name="))
PosBeg = Pos+6
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filen ame="))
PosBound = InstrB(PosEnd,RequestBin,boundary)

If PosFile<>0 AND (PosFile<PosBound) Then

PosBeg = PosFile + 10
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "FileName", FileName
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
PosBeg = Pos+14
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "ContentType",ContentType

PosBeg = PosEnd+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)

Else

Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg = Pos+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))

End If

UploadControl.Add "Value" , Value
UploadRequest.Add name, UploadControl
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),Requ estBin,boundary)
Loop

End Function

Function getByteString(StringStr)
For i = 1 to Len(StringStr)

char = Mid(StringStr,i,1)
getByteString = getByteString & chrB(AscB(char))

Next
End Function


Function getString(StringBin)
getString =""
For intCount = 1 to LenB(StringBin)
getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next
End Function


If request("Action")="1" then

Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUpload(RequestBin)

'Create the file, change the path to the path U use for temp storage of the file
'make sure you have the IUSR_YOURCOMPUTER granted WRITE access to the uploads dir

If UploadRequest.Item("blob").Item("Value") <> "" Then

contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
FolderName = UploadRequest.Item("where").Item("Value")
Path = Mid(Request.ServerVariables("PATH_TRANSLATED"), 1, Len(Request.ServerVariables("PATH_TRANSLATED")) - Len(Request.ServerVariables("PATH_INFO")))
ToFolder = Path & "\" & FolderName
value = UploadRequest.Item("blob").Item("Value")
filename = ToFolder & "\" & filename
Set MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = MyFileObject.CreateTextFile(filename)

For i = 1 to LenB(value)

objFile.Write chr(AscB(MidB(value,i,1)))

Next
objFile.Close
Set objFile = Nothing
Set MyFileObject = Nothing

End If
Title = UploadRequest.Item("Title").Item("Value")
FirstName = UploadRequest.Item("First_Name").Item("Value")
LastName = UploadRequest.Item("Last_Name").Item("Value")
Building_No_Name = UploadRequest.Item("Building_No_Name").Item("Value ")
Street = UploadRequest.Item("Street").Item("Value")
Town = UploadRequest.Item("Town").Item("Value")
County = UploadRequest.Item("County").Item("Value")
Postcode = UploadRequest.Item("Postcode").Item("Value")
Telephone_Number = UploadRequest.Item("Telephone_Number").Item("Value ")
Mobile_Number = UploadRequest.Item("Mobile_Number").Item("Value")
Work_Number = UploadRequest.Item("Work_Number").Item("Value")
Email_Address = UploadRequest.Item("Email_Address").Item("Value")
Sector = UploadRequest.Item("Sector").Item("Value")
Set UploadRequest = Nothing

body="<html><body><p align='center'><font size='5' face='Times New Roman' color='#0000FF'>Candidate Registration Form </font></p>"
body=body & "<table align='center'> <tr><td><font size='3' face='Times New Roman' color='#660033'>Title: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Title & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>First Name: </td><td><font size='3' face='Times New Roman' color='#660033'>" & first_Name & "</td></tr>"
body=body & "<table align='center'> <tr><td><font size='3' face='Times New Roman' color='#660033'>Last Name: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Last_Name & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Building Name/Number: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Building_No_Name & "</td></tr>"
body=body & "<table align='center'> <tr><td><font size='3' face='Times New Roman' color='#660033'>Street: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Street & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Town: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Town & "</td></tr>"
body=body & "<table align='center'> <tr><td><font size='3' face='Times New Roman' color='#660033'>County: </td><td><font size='3' face='Times New Roman' color='#660033'>" & County & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Postcode: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Postcode & "</td></tr>"
body=body & "<table align='center'> <tr><td><font size='3' face='Times New Roman' color='#660033'>Telephone Number: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Telephone_Number & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Mobile Number: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Mobile_Number & "</td></tr>"
body=body & "<table align='center'> <tr><td><font size='3' face='Times New Roman' color='#660033'>Work Number: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Work_Number & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Email Address: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Email_Address & "</td></tr>"
body=body & "<table align='center'><tr><td><font size='3' face='Times New Roman' color='#660033'>Sector: </td><td><font size='3' face='Times New Roman' color='#660033'>" & Sector & "</td></tr>"
body = body & "</table></body></html>"


Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
ObjCDOMail.From = Email_Address
ObjCDOMail.To = "steve.owens@rslsteeper.com"
ObjCDOMail.BodyFormat = 0
ObjCDOmail.Mailformat = 0
ObjCDOMail.Subject = "Candidate Registration Form" & MyPosition
ObjCDOMail.Body = body

If Len(filename) > 5 then

ObjCDOMail.AttachFile filename,nikfile


end if

ObjCDOMail.Send
Set ObjCDOMail = Nothing

' Now the file in the uploads dir can be deleted

Set fso = CreateObject("Scripting.FileSystemObject")

fso.DeleteFile filename
set fso = nothing

End If

%>
<html>
<script language='javascript'>
alert("Thank You for Registering Yor Resume");
location.replace("index.htm");
</script>
</html>


please can some one tell me why it wont work or can they help me fix it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old Aug 21st, 2003, 14:17
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Can you be more specific as to WHY it wont work....

IE. What is happening.... what error messages are you getting?

I can see that you need to change this line in your form:-
<input name="CV" type="file" id="CV">

to this:-
<input name="blob" type="file" id="blob">
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
Old Aug 21st, 2003, 14:22
Junior Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
i am getting the java message at the end but i am not recieving any emails

it would not work at all when i had the *.asp?ACTION=1"

so when i took of the ?ACTION=1"

it ran the java script at the end but still did not get any email
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #11  
Old Aug 21st, 2003, 14:27
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
try changing this:-

<form METHOD="POST" ENCTYPE="multipart/form-data" action="cvupload.asp" name="mailform" id="mailform">

to this:-

<form METHOD="POST" ENCTYPE="multipart/form-data" action="cvupload.asp?action=1" name="mailform" id="mailform">

you need the action=1 for it to send email.

If you get error msg's... can you tell me what they are.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!