title: Cannot redeclare PHPMailerAutoload()?
body: <p>I start implementing  a function of Emailing mass users, When I click on post the I get the following error.</p>
  
  <blockquote>
    <p>Cannot redeclare PHPMailerAutoload() (previously declared in C:\xampp\htdocs\bloodbank2\phpmailer\PHPMailerAutoload.php:24) in C:\xampp\htdocs\bloodbank2\phpmailer\PHPMailerAutoload.php on line 31</p>
  </blockquote>
  
  <p>However the first user in the database is able to receive the Email and the rest dont. </p>
  
  <p>Here are my codes.<br>
  1st one is news.php, which allows person to post the news.</p>
  
  <pre><code>          &lt;?php include 'core/init.php'; ?&gt;
            &lt;?php include 'includes/overall/oheader.php'; 
  
            if (empty($_POST) === false){
  
             $require_fields = array('heading', 'information');
  
             foreach($_POST as $key=&gt;$value){
              if(empty($value) &amp;&amp; in_array($key, $require_fields) === true){
                      $errors[] = 'Fields marked with an asterisk are  required';
                      break 1;
  
              }
  
              }
              }
  
              if(isset($_GET['success']) &amp;&amp; empty($_GET['success'])){
  
              echo 'information posted';
  
              }else{
  
  
              if(empty($_POST) === false &amp;&amp; empty($errors) === true){
              $insert_data = array(
                  'heading'       =&gt; $_POST['heading'],
                  'information'       =&gt; $_POST['information']
  
  
              );
  
              //
              //redirect
  
                      mail_users($_POST['heading'], $_POST['information']);   
                      header('Location: news.php?success');
                      news_data($insert_data);
                      //exit
                      exit();
  
  
  
          }
  
  
          ?&gt;
  
          &lt;h1&gt;News&lt;/h1&gt;
          &lt;p&gt;Just a Template&lt;/p&gt;  
  
  
  
  
             &lt;form action="" method="post"&gt;
              &lt;ul&gt;
                  &lt;li&gt;
                      Heading*:&lt;br&gt;
                      &lt;textarea rows="2" cols="40"  name="heading"maxlength="50"&gt;&lt;/textarea&gt;
  
                  &lt;/li&gt;
  
                  &lt;li&gt;
  
  
                      information*:&lt;br&gt;
                      &lt;textarea rows="10" cols="40"  name="information"&gt; &lt;/textarea&gt;
  
                  &lt;/li&gt;
  
                  &lt;li&gt;
  
  
                      &lt;input type="submit" value="Post" name="save"&gt;
  
                  &lt;/li&gt;
  
              &lt;ul&gt;
  
  
          &lt;?php 
          }
  
          include 'includes/overall/ofooter.php'; ?&gt;
  </code></pre>
  
  <p>2nd code is the functions 
  function mail_user();</p>
  
  <pre><code>         function mail_users($subject, $body){
  
            $query = mysql_query("SELECT `email`, `first_name` FROM `users`");
  
            while(($row = mysql_fetch_assoc($query)) !== false){
  
             $body = "Hello" . $row['first_name'] . ",\n\n" . $body;
             email($row['email'], $subject, $body);
  
  
            }
  
           }
  </code></pre>
  
  <p>3rd is the email function that a contains the php mailer.</p>
  
  <pre><code>             function email($to, $subject, $body){
  
                require '/phpmailer/PHPMailerAutoload.php';
                require '/phpmailer/class.phpmailer.php';
  
                error_reporting(-1);
                $mail = new PHPMailer(true);
  
                $mail-&gt;SMTPDebug = 0;                               // Enable verbose debug output
  
                $mail-&gt;isSMTP(true);                                      // Set mailer to use SMTP
                $mail-&gt;Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
                $mail-&gt;SMTPAuth = true;                               //             Enable SMTP authentication
                $mail-&gt;Username = '';                 // SMTP username
                $mail-&gt;Password = '';                           // SMTP password
                $mail-&gt;SMTPSecure = 'tls';                            //         Enable TLS encryption, `ssl` also accepted
                $mail-&gt;Port = 587;                                    // TCP port to connect to
  
                $mail-&gt;setFrom('');
                $mail-&gt;addAddress(''.$to.'');     // Add a recipient
                $mail-&gt;isHTML(true);                                  // Set Email format to HTML
  
                $mail-&gt;Subject = ''.$subject.'';
                  $mail-&gt;Body    = ''.$body.'';
                 $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.';
                    echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;
                    } else {
                  echo 'Message has been sent';
                   }
  
                 }
  </code></pre>
  
  <p>So how will I get rid of the error so that everyone is database receives the mail?</p>