Wednesday, March 16, 2016

How to read file in PHP and send Mail

          $emailMessage='';
                 $emailSubject = "I this is Manojkumar";
                 $fp =@fopen("mail.html","r");
                 if($fp)
                 {
                        while(!feof($fp))
                        {
                                $file = str_replace("[!IDS::EMAIL!]", strtolower($email),fgets($fp));
                                $file = str_replace("[!IDS::DATE!]", date('m/d/Y'),$file);
                                $file = str_replace("[!IDS::NAME!]", $name, $file);
                                $emailMessage .= $file;
                        }
                 }
                 mail($email, $fromEmail, $emailSubject, '', $emailMessage);