title: “Could Not Access File:” in PHPmail function
body: <p>I am trying to email a file that exists on my server using PHPMailer. When I run this code, I get "Could not access file" and the email sends without the attachment.can anyone guide me how to fix this</p>
  
  <pre><code>    $checkyes=$_POST['check'];
      $date = date('Y-m-d');
  
      $my_path ="/data/data/www/fms/pricelists/$checkyes{$date}.xls";
  
      include "class.phpmailer.php"; // include the class file name
      $mail = new PHPMailer(); // create a new object
      $mail-&gt;IsSMTP(); // enable SMTP
      $mail-&gt;SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
      $mail-&gt;SMTPAuth = true; // authentication enabled
      //$mail-&gt;SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
      $mail-&gt;Host = "mail.authsmtp.com";
      $mail-&gt;Port = "25"; // or 587
      $mail-&gt;IsHTML(true);
      $mail-&gt;Username = "xxxx";
      $mail-&gt;Password = "xxxxxxx";
      $mail-&gt;SetFrom("xxxxxxxxx");
      $mail-&gt;Subject = $sub1;
      $mail-&gt;Body = $text_mail;
      $mail-&gt;AddAddress("xxx@xxxxxx.com");
      $mail-&gt;AddAddress("xxxxxxx@gmail.com");
  
      $mail-&gt;AddAttachment($my_file, $my_path);
       if(!$mail-&gt;Send()){
       echo "Mailer Error: " . $mail-&gt;ErrorInfo;
      }
      else{
       echo "Message has been sent";
      }
  </code></pre>