title: Fatal error: Class 'Swift_smtpTransport' not found in
body: <p>I am trying to add the functionality to send my customers emails from my website backend and am attempting to use swiftmailer to do this. 
  I unfortunately keep getting an error message </p>
  
  <pre><code>Fatal error: Class 'Swift_smtpTransport' not found in /home/u312041955/public_html/cust/modules/customer/email.php on line 94
  </code></pre>
  
  <p>Although it seem to me like the swiftmailer class is not being included properly it must be as otherwise the page does not display any information at all. 
  The code from the page I am using swiftmailer from is as follows.</p>
  
  <pre><code>&lt;?php require_once("include.php");
      //Required for swift mailer
      require_once (INCLUDE_URL.'/swift/lib/swift_required.php');
      if(!xml2php("customer")) {
      $smarty-&gt;assign('error_msg',"Error in language file");
      }
      // Lets grab some variables we need
      $email_username = $VAR['email_username'];
      $email_password = $VAR['email_password'];
      $email_server = $VAR['email_server2'];
      $email_server_port = $VAR['email_server_port2'];
      $customer_id = $VAR['customer_id'];
      $c2 = $VAR['c2'];
      $download_id = $VAR['download_id'];
      $submit = $VAR['submit'];
      $email_to = $VAR['email_to'];
      $email_from = $VAR['email_from'];
      $email_subject = $VAR['email_subject'];
      $message_body = $VAR['message_body'];
      $attachment = $VAR['attachment'];
      $rr_email = $VAR['rr'];
      $cus_name = $VAR['cus_name'];
      $sig = "&lt;br&gt;Regards,&lt;br&gt;".$employee_details ['EMPLOYEE_FIRST_NAME']."&lt;br&gt;MD-PC";
  
  //Get All customer Emails
  $q = "SELECT * FROM ".PRFX."TABLE_CUSTOMER_EMAILS WHERE CUSTOMER_ID ='".$customer_id."' ORDER BY CUSTOMER_EMAIL_ID DESC" ;
  $rs = $db-&gt;Execute($q);
  $customer_emails = $rs-&gt;GetArray();
  $smarty-&gt;assign('customer_emails', $customer_emails);
  /*Get Customer Info */
  $q = "SELECT * FROM ".PRFX."TABLE_CUSTOMER WHERE CUSTOMER_ID ='".$customer_id."'" ;
  $rs = $db-&gt;Execute($q);
  $customer_details = $rs-&gt;GetArray();
  $smarty-&gt;assign('customer_details', $customer_details);
  /*Get Employee Info */
  $q = "SELECT * FROM ".PRFX."TABLE_EMPLOYEE WHERE EMPLOYEE_DISPLAY_NAME ='".$login."'" ;
  $rs = $db-&gt;Execute($q);
  $employee_details = $rs-&gt;FetchRow();
  $smarty-&gt;assign('employee_details', $employee_details);
  // assign the arrays
  $smarty-&gt;assign('open_work_orders', display_open_workorders($db, $customer_id));
  $smarty-&gt;assign('closed_work_orders',   display_closed_workorders($db, $customer_id));
  //$smarty-&gt;assign('customer_details',   display_customer_info($db, $customer_id));
  $smarty-&gt;assign('customer_details',$customer_details);
  $smarty-&gt;assign('unpaid_invoices', display_unpaid_invoices($db,$customer_id));
  $smarty-&gt;assign('paid_invoices', display_paid_invoices($db,$customer_id));
  $smarty-&gt;assign('memo', display_memo($db,$customer_id));
  $smarty-&gt;assign('gift', display_gift($db, $customer_id));
  $smarty-&gt;assign('company_details',display_company_info($db, $company_id));
  //Lets Get the file downloaded to have a look at it from the database
  if(isset ($download_id)){
   /*Get All customer Emails */
  $q = "SELECT CUSTOMER_EMAIL_ATT_NAME1, CUSTOMER_EMAIL_ATT_TYPE1, CUSTOMER_EMAIL_ATT_SIZE1, CUSTOMER_EMAIL_ATT_FILE1,  FROM ".PRFX."TABLE_CUSTOMER_EMAILS WHERE CUSTOMER_EMAIL_ID ='".$download_id."'" ;
  $rs = $db-&gt;Execute($q);
  //header("Content-length: $rs-&gt;fields['CUSTOMER_EMAIL_ATT_SIZE1']");
  //header("Content-type: $rs-&gt;fields['CUSTOMER_EMAIL_ATT_TYPE1']");
  //header("Content-Disposition: attachment; filename=$rs-&gt;fields['CUSTOMER_EMAIL_ATT_NAME1']");
  $file_download= $rs-&gt;fields['CUSTOMER_EMAIL_ATT_FILE1'];
  $smarty-&gt;assign('file_download', $file_download);
  //Print $CUSTOMER_EMAIL_ATT_NAME1;
   exit;
  
   }
  // BOF Email Message details
  //Mail
  if(isset ($submit)){
      if($_FILES['attachment1']['size'] &gt;  0 ){
      $fp      = fopen($_FILES['attachment1']['tmp_name'], 'r');
      $content1 = fread($fp, filesize($_FILES['attachment1']['tmp_name']));
      $content1 = addslashes($content1);
      fclose($fp);
      }
      $sql = "INSERT INTO ".PRFX."TABLE_CUSTOMER_EMAILS SET
              CUSTOMER_ID             = ". $db-&gt;qstr($VAR["c2"]).",
              CUSTOMER_EMAIL_ADDRESS  = ". $db-&gt;qstr( $VAR["email_to"]).",
              CUSTOMER_FROM_EMAIL_ADDRESS = ". $db-&gt;qstr( $VAR["email_from"]).",
              CUSTOMER_EMAIL_SENT_BY      = ". $db-&gt;qstr( $login ).", 
              CUSTOMER_EMAIL_SENT_ON      = ". $db-&gt;qstr( time()).",
              CUSTOMER_EMAIL_SUBJECT      = ". $db-&gt;qstr( $VAR["email_subject"]).",
              CUSTOMER_EMAIL_BODY = ". $db-&gt;qstr( $VAR["message_body"]).",
              CUSTOMER_EMAIL_ATT_NAME1    = ". $db-&gt;qstr( $_FILES['attachment1']['name']).",
              CUSTOMER_EMAIL_ATT_TYPE1        = ". $db-&gt;qstr( $_FILES['attachment1']['type']).",
              CUSTOMER_EMAIL_ATT_SIZE1        = ". $db-&gt;qstr( $_FILES['attachment1']['size']).",
              CUSTOMER_EMAIL_ATT_FILE1    = ". $db-&gt;qstr( $content1 ); 
  
  
  
      if(!$result = $db-&gt;Execute($sql)) {
          force_page('core', 'error&amp;error_msg=MySQL Error: '.$db-&gt;ErrorMsg().'&amp;menu=1&amp;type=database');
          exit;
      }
  //print $sql ;
      $transport = Swift_smtpTransport::newInstance( "mx1.hostinger.co.uk" , 2525 )
      -&gt;setUsername('noreply@example.co.uk')
      -&gt;setPassword('******');
      $mailer = Swift_Mailer::newInstance($transport);
      //Create a message
      $message = Swift_Message::newInstance($email_subject)
        -&gt;setFrom(array($email_from =&gt; $employee_details['EMPLOYEE_FIRST_NAME']))
       -&gt;setTo(array($email_to =&gt; $cus_name))
       -&gt;setBody($strip )
       -&gt;addPart('Hello '.$cus_name , 'text/html')
       -&gt;addPart($message_body, 'text/plain')
       -&gt;attach(Swift_Attachment::fromPath($target_path));
       //Send the message
       $numSent = $mailer-&gt;send($message);
       //Display how many messages were sent
       echo "&lt;script&gt;alert('Email Information')&lt;/script&gt;";
       echo "Sent %d messages\n", $numSent;
       exit(); 
  
      }
      ?&gt;
  </code></pre>
  
  <p>I have been struggling with this now or some time and could use a shove in the right direction. </p>
  
  <p>Update 1: I have been continuing to play around with this and when i change the line</p>
  
  <pre><code>$transport = Swift_smtpTransport::newInstance( "mx1.hostinger.co.uk" , 2525 )
  -&gt;setUsername('noreply@example.co.uk')
  -&gt;setPassword('******');
  </code></pre>
  
  <p>To simply </p>
  
  <pre><code>$transport = Swift_MailTransport::newInstance()
  </code></pre>
  
  <p>so it isn't using SMTP anymore i get a message sent successfully notification but for some reason it sends it to the from email address and also gets marked as spam because it may not have originated from the account hence why I want to use smtp. 
  Update 2: after reading other threads I found that </p>
  
  <pre><code>$transport = Swift_smtpTransport::newInstance( "mx1.hostinger.co.uk" , 2525 );
  </code></pre>
  
  <p>Should in fact be </p>
  
  <pre><code>$transport = Swift_SmtpTransport::newyInstance( "mx1.hostinger.co.uk" , 2525 )
  ;
  </code></pre>
  
  <p>This gets rid of the class not found error but I now get a timeout error. I am certain I am using the correct mail server detail as I got them from my host. 
  Any help very much appreciated. </p>