-5

This my code plz provide me solution

<?php
    class email
    {
      function emailWithAttach($fromaddress,$toAddress,$mailSubject,$mailMessageHead,$mailMessageMain,$mailMessageSign,$filePath,$fileName)
     {
     $fileatt_name = $fileName;
     $fileatt = $filePath.$fileName;
     $fileatt_type = "application/octet-stream";
     $email_from = $fromaddress;
     $email_subject = $mailSubject;
     $email_message = $mailMessageHead."<br>";
     $email_message .= $mailMessageMain."<br>";
     $email_message .= $mailMessageSign;
     $headers = '';
     $email_to = $toAddress;
     $headers = "From: ".$email_from;
     $file = fopen($fileatt, 'rb');
     $data = fread($file,filesize($fileatt));
     fclose($file);
     empty($mime_boundary); /*i also tried empty function still getting notice.*/
     $semi_rand = md5(time());
     $mime_boundary = "==Multipart_Boundary_X{$semi_rand}X";

     $headers .= "\nMIME-Version: 1.0\n" .
      "Content-Type: multipart/mixed;\n" .
      " boundary=\"{$mime_boundary}\"";

      $email_message .= "This is a multi-part message in MIME format.\n\n" .
      "--{$mime_boundary}\n" .
      "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
      "Content-Transfer-Encoding: 7bit\n\n" .
      $email_message .= "\n\n";

      $data = chunk_split(base64_encode($data));

      $email_message .= "--{$mime_boundary}\n" .
      "Content-Type: {$fileatt_type};\n" .
      " name=\" {$fileatt_name}\"\n" .
      "Content-Transfer-Encoding: base64\n\n" .
      $data .= "\n\n". /*i m getting error on this line */
      "--{$mime_boundary}--\n";


      if(@mail($email_to, $email_subject, $email_message, $headers))
      {
          return true;
      }
      }
    } 
    ?>
Hanky Panky
  • 46,730
  • 8
  • 72
  • 95
  • Possible duplicate of [How to determine if variable is 'undefined' or 'null'](http://stackoverflow.com/questions/2647867/how-to-determine-if-variable-is-undefined-or-null) – Abdulla Nilam Jan 15 '16 at 08:06
  • Where do you set the $mime_boundary variable? It looks like you a referring to a non defined variable. – jpou Jan 15 '16 at 08:08
  • Give us the complete error message including line number! – deceze Jan 15 '16 at 08:08
  • Hi and welcome to SO, I strongly recommend that you have a look at [the tour](http://stackoverflow.com/tour) to get a better idea of how SO works. SO is **not** a free debug service. – Epodax Jan 15 '16 at 08:15
  • @deceze complete error message Notice: Undefined variable: mime_bondary in C:\xampp\htdocs\xampp\talentpunditsv2\current-openings\jobs\emailClass.php on line 41 – satish jha Jan 15 '16 at 08:30
  • ***bondary***?! Really? If really so, you merely have a ***typo***. – deceze Jan 15 '16 at 08:53
  • @deceze might be but i m unable to find that typo. could you plz help me to find out that typo – satish jha Jan 15 '16 at 09:01

1 Answers1

0

You can try using this:

$mime_boundary = isset($mime_boundary) ? $mime_boundary : '';

in place of:

empty($mime_boundary);

but i think this is no sense...this variable ($mime_boundary) is not exist in your function, so this is empty. You can skip this check and remove this line.

Fabio
  • 21
  • 5