title: php email using PHPMailer not working
body: <p>Im having trouble sending an email via my web form, I am using PHP and a PHPMailer Class</p>
  
  <p>My Form Code iS</p>
  
  <pre><code>&lt;form class="cd-form floating-labels" method="post" action="email.php" enctype="multipart/form-data"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Contact Us&lt;/legend&gt;
  
          &lt;div class="icon"&gt;
              &lt;label class="cd-label" for="cd-name"&gt;Name&lt;/label&gt;
              &lt;input class="user" type="text" name="cd-name" id="cd-name" value="&lt;?php if(isset($_POST["cd-name"])){echo $_POST["cd-name"];}else{echo "";}?&gt; required&gt;
          &lt;/div&gt; 
  
          &lt;div class="icon"&gt;
              &lt;label class="cd-label" for="cd-company"&gt;Company&lt;/label&gt;
              &lt;input class="company" type="text" name="cd-company" id="cd-company" required&gt;
          &lt;/div&gt; 
  
          &lt;div class="icon"&gt;
              &lt;label class="cd-label" for="cd-email"&gt;Email&lt;/label&gt;
              &lt;input class="email" type="email" name="cd-email" id="cd-email" required&gt;
          &lt;/div&gt;
  
          &lt;div class="icon"&gt;
              &lt;label class="cd-label" for="cd-phone"&gt;Contact No&lt;/label&gt;
              &lt;input class="phone" type="text" name="cd-phone" id="cd-phone" required&gt;
          &lt;/div&gt;
  
  
      &lt;/fieldset&gt;
  
      &lt;fieldset&gt;
          &lt;div class="icon"&gt;
              &lt;label class="cd-label" for="cd-message"&gt;Project description&lt;/label&gt;
              &lt;textarea class="message" name="cd-message" id="cd-message" required&gt;&lt;/textarea&gt;
          &lt;/div&gt;
  
      &lt;div class='icon'&gt;
          &lt;label class="cd-upload" for='cd-upload' &gt;Another upload:&lt;/label&gt;
          &lt;input type="file" name='cd-upload' id='cd-upload' /&gt;
      &lt;/div&gt;
  
      &lt;div&gt;
          &lt;p class="cd-select icon"&gt;
              &lt;select name="cd-hearsay" class="budget"&gt;
                  &lt;option value="0"&gt;Where Did You Hear About Us?&lt;/option&gt;
                  &lt;option value="1"&gt;Google&lt;/option&gt;
                  &lt;option value="2"&gt;Friend / Family&lt;/option&gt;
                  &lt;option value="3"&gt;Ad On A Website&lt;/option&gt;
              &lt;/select&gt;
          &lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div class="icon"&gt;
              &lt;label class="cd-label" for="cd-coupon"&gt;Coupon Code&lt;/label&gt;
              &lt;input class="coupon" type="text" name="cd-coupon" id="cd-name"&gt;
          &lt;/div&gt;             
  
          &lt;div&gt;
              &lt;input type="submit" value="Send Message"&gt;
          &lt;/div&gt;
  
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and My email.php code is</p>
  
  <pre><code>    &lt;?php
  require("class.phpmailer.php");
  
  // define variables and set to empty values
  $name = $company = $email = $phone = $message = $upload = $hearsay = $coupon =  "";
  $nameErr = $companyErr = $emailErr = $phoneErr = $messageErr = $uploadErr = $hearsayErr = $couponErr =  "";
  
  
  function clean($data) {
     $data = trim($data);
     $data = stripslashes($data);
     $data = htmlspecialchars($data);
     return $data;
  }
  
  //clean varibles
  $company = clean($_POST['cd-company']);
  $upload = clean($_POST['cd-upload']);
  $hearsay = clean($_POST['cd-hearsay']);
  $coupon = clean($_POST['cd-coupon']);
  
  //validate varibles
  
  //Check Name
  if(empty($_POST['cd-name']))
  {
      $nameErr = "Name Field is Required";
  }
  elseif(strlen($_POST['cd-name']) &lt;= 3)
  {
      $nameErr = "Please provide your full name";
  }
  elseif(!ctype_alpha($_POST['cd-name']))
  {
      $nameErr = "Please only use letters in your name";
  }
  else
  {
      $name = clean($_POST['cd-name']);
  }
  
  //Check Email
  if (empty($_POST["cd-email"])) 
  {
      $emailErr = "Email is required";
  }
  elseif(!filter_var($_POST["cd-email"], FILTER_VALIDATE_EMAIL))
  {
      $emailErr = "Invalid Email Format"; 
  } 
  else
  {
      $email = clean($_POST["cd-email"]);
  }
  
  //Check Phone
  if(empty($_POST['cd-phone']))
  {
      $phoneErr = "Phone number is required";
  }
  elseif(!is_numeric($_POST['cd-phone']))
  {
      $phoneErr = "Please use numers only";
  }
  else
  {
      $phone = clean($_POST['cd-phone']);
  }
  
  //Check Message
  if(empty($_POST['cd-message']))
  {
      $messageErr = "Message is blank!";
  }
  elseif(!ctype_alnum($_POST['cd-message']))
  {
      $messageErr = "Please use numbers and letters only";    
  }
  else
  {
      $message = clean($_POST['cd-message']);
  
  }
  
  //Check Upload File Types / Size
  if(!empty($_POST['cd-upload']))
  {
      //Get the uploaded file information
      $name_of_uploaded_file = basename($_FILES['uploaded_file']['name']);
  
      //get the file extension of the file
      $type_of_uploaded_file = substr($name_of_uploaded_file, strrpos($name_of_uploaded_file, '.') + 1);
      $size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;//size in KBs
  
      //Settings
      $max_allowed_file_size = 100; // size in KB
      $allowed_extensions = array("doc", "xls", "txt");
  
      //Validations
      if($size_of_uploaded_file &gt; $max_allowed_file_size )
      {
        $uploadErr .= "\n Size of file should be less than $max_allowed_file_size";
      }
  
      //------ Validate the file extension -----
      $allowed_ext = false;
      for($i=0; $i&lt;sizeof($allowed_extensions); $i++)
      {
        if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
        {
          $allowed_ext = true;
        }
      }
  
      if(!$allowed_ext)
      {
        $uploadErr .= "\n The uploaded file is not supported file type. ".
        " Only the following file types are supported: ".implode(',',$allowed_extensions);
      }
  
      //copy the temp. uploaded file to uploads folder
      $path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
      $tmp_path = $_FILES["uploaded_file"]["tmp_name"];
  
      if(is_uploaded_file($tmp_path))
      {
        if(!copy($tmp_path,$path_of_uploaded_file))
        {
          $uploadErr .= '\n error while copying the uploaded file';
        }
      }
  }
  
  
  if(!$nameErr &amp;&amp; !$emailErr &amp;&amp; !$phoneErr &amp;&amp; !$messageErr &amp;&amp; !$uploadErr)
  {
      echo "no errors";
      $mail = new PHPMailer();
  
      $mail-&gt;IsSMTP();                                      // set mailer to use SMTP
      $mail-&gt;Host = "send.one.com";  // specify main and backup server
      $mail-&gt;SMTPAuth = true;     // turn on SMTP authentication
      $mail-&gt;Username = "jswan";  // SMTP username
      $mail-&gt;Password = "secret"; // SMTP password
  
      $mail-&gt;From = $email;
      $mail-&gt;FromName = $name;
      $mail-&gt;AddAddress("testemail@hotmail.co.uk", "Looty Jackinson");
      #$mail-&gt;AddAddress("ellen@example.com");                  // name is optional
      $mail-&gt;AddReplyTo("info@example.com", "Information");
  
      $mail-&gt;WordWrap = 50;                                 // set word wrap to 50 characters
      $mail-&gt;AddAttachment("uploads");         // add attachments
      #$mail-&gt;AddAttachment("uploads/image.jpg", "new.jpg");    // optional name
      $mail-&gt;IsHTML(true);                                  // set email format to HTML
  
      $mail-&gt;Subject = "Here is the subject";
      $mail-&gt;Body    = "This is the HTML message body &lt;b&gt;in bold!&lt;/b&gt;";
      $mail-&gt;AltBody = "This is the body in plain text for non-HTML mail clients";
  
      if(!$mail-&gt;Send())
      {
         echo "Message could not be sent. &lt;p&gt;";
         echo "Mailer Error: " . $mail-&gt;ErrorInfo;
         exit;
      }
  
      echo "Message has been sent";
  }
  else
  {
      echo "errors";
      print_r($nameErr);
      print_r($emailErr);
      print_r($phoneErr);
      print_r($uploadErr);    
      #header("index.php");
  }
  ?&gt;
  </code></pre>
  
  <p>but this is resulting in the following error, no errorsCould not access file: uploads Warning: require_once(class.smtp.php): failed to open stream: No such file or directory in /customers/2/9/2/kernow-connect.com/httpd.www/contact-form/class.phpmailer.php on line 760 Fatal error: require_once(): Failed opening required 'class.smtp.php' (include_path='.:/usr/share/php') in /customers/2/9/2/kernow-connect.com/httpd.www/contact-form/class.phpmailer.php on line 760</p>
  
  <p>i am really unsure what i am doing at this point and would really appreciate some help please!</p>
  
  <p>You can see the problem(s) at <a href="http://www.kernow-connect.com/contact-form/form.php" rel="nofollow">http://www.kernow-connect.com/contact-form/form.php</a></p>
  
  <p>I can post the content of the PHPMailer.php if needed
  Many Thanks</p>
  
  <p>Luke</p>