SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why Won't My Email Code Work???

    Hi all,

    I want to set up an application form where the user can send an attachment by email.

    For some reason code doesn't function right. I get Internal Server Error - page cannot be displayed. Any ideas??

    Here is my code:

    PHP Code:
    <%
     
         
     
    Dim objMail
     Dim MyBody
     Dim MyCDONTSMail
         
     dim name
     dim email
     dim current_position
     dim position_applied
     dim education
     dim salary
     dim availability
     dim address1
     dim address2
     dim country
     dim phone
     dim cv
     dim comments
     dim submitted
     
     
     submitted
    =Request.Form("submitted")
     
    name=Request.Form("name")
     
    email=Request.Form("email")
     
    current_position=Request.Form("current_position")
     
    position_applied=Request.Form("position_applied")
     
    education=Request.Form("education")
     
    salary=Request.Form("salary")
     
    availability=Request.Form("availability")
     
    comments=Request.Form("comments")
     
    address1=Request.Form("address1")
     
    address2=Request.Form("address2")
     
    country=Request.Form("country")
     
    phone=Request.Form("phone")
     
    cv=Request.Form("Fileatt")
     
     If 
    submitted<>"true" Then
      
    %>
           <
    p>You did not press submit!</p>
      <%
      Else
               If (
    name "" or email ""Then
               
    %>
               <
    p>Please enter your name and email</p>
              <
    p><a href="#" onClick="history.go(-1)">Return</a></p><br />
               <%
                Else
                       If 
    country "" Then
                       
    %>
                        <
    p>Please enter your Country</p>
                       <
    p><a href="#" onClick="history.go(-1)">Return</a></p><br />
                       <%
                       Else
                               If (
    current_position "" or position_applied ""Then
                              
    %>
                              <
    p>Please enter your current Position</p>
                              <
    p><a href="#" onClick="history.go(-1)">Return</a></p><br />
                              <%
                              Else
                                       If 
    education "" Then
                                      
    %>
                                      <
    p>Please enter your education</p>
                                      <
    p><a href="#" onClick="history.go(-1)">Return</a></p><br />
                                      <%
                                      Else
                                               If 
    salary "" Then
                                              
    %>
                                              <
    p>Please enter your Salary</p>
                                               <
    p><a href="#" onClick="history.go(-1)">Return</a></p><br />
                                              <%
                                              Else
                                                       If 
    availability "" Then
                                                      
    %>
                                                      <
    p>Please enter your date of availability</p>
                                                        <
    p><a href="#" onClick="history.go(-1)">Return</a></p><br />
                                                       <% 
                                                      Else 
                                                                  If 
    phone "" Then
                                                                  
    %>
                                                                  <
    p>Please enter your Phone number</p>
                                                                    <
    p><a href="#" onClick="history.go(-1)">Return</a></p><br />
                                                                   <%
                                                                  Else
                                                      
            
    Set objMail Server.CreateObject("CDONTS.NewMail")
          
    objMail.From email
          objMail
    .Subject "Job Application Form"
          
    objMail.To "kevin.o'brien@pfpc.ie"
              
              
              
    MyCDONTSMail.Attachfile cv
              
          MyBody 
    "Name: " name vbCrLf
              MyBody 
    MyBody "Email: " email VbCrLf
              MyBody 
    MyBody "Address: " address1 VbCrLf
          MyBody 
    MyBody "Address2: " address2 VbCrLf
          MyBody 
    MyBody "Country: " country VbCrLf
          MyBody 
    MyBody "Phone: " phone VbCrLf
              MyBody 
    MyBody "Education: " education VbCrLf
              MyBody 
    MyBody "Current Position: " current_position VbCrLf
              MyBody 
    MyBody "Position Applied For: " position_applied VbCrLf
              MyBody 
    MyBody "Salary Expectations: " salary VbCrLf
              MyBody 
    MyBody "Availability: " availability VbCrLf
          MyBody 
    MyBody "Comments: " VbCrLf comments VbCrLf
              MyCDONTSMail
    .BodyMyBody
          MyCDONTSMail
    .Send
              set objMail 
    nothing
      
                                        
    %>
                                  <
    p>Thank You <% Response.Write(name) %>Your application has been submitted.</p>
                                  <%
                                    
                                      
                                      
    End If
                                     
    End If
                                 
    End If
                             
    End If
                         
    End If
                     
    End If
                 
    End If
             
    End If
                 %> 
    Last edited by obrienkev; May 9, 2005 at 03:01.

  2. #2
    SitePoint Wizard
    Join Date
    Apr 2004
    Location
    dublin
    Posts
    2,036
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone please??

    Basically I have created a webpage where the user fills out a form, attaches a document, presses submit and the data is sent to info.asp where the code will check fields filled in, etc. and send the details and attavhment.

    What am I doing wrong??

    Get this error:
    Microsoft VBScript runtime error '800a01a8'

    Object required: ''

    /website/careers/application.asp, line 141

  3. #3
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your getting this error because you haven't uploaded the file before sending it. With asp based mailing components, you can't send a file like you can in outlook. You have to upload that file to the server, then send it then delete it.

    Gav


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •