D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
designpitara.com
/
feedback-form
/
Filename :
mail.php
back
Copy
<?php if(isset($_POST['submit'])){ $name = $_POST['name']; $designation = $_POST['Designation']; $email = $_POST['email']; $service=implode(',',$_POST['service']); $message = str_replace("'","/'",$_POST['message']); if(isset($_FILES["blog_img"]) && $_FILES['blog_img']['size'] != 0){ /* Rename Image */ $time_now=mktime(date('h')+5,date('i')+30,date('s')); $serialNo = date('dmYHis', $time_now); $targetDirectory = "image/"; /* Explode Extension*/ $temp = explode(".", $_FILES["blog_img"]["name"]); $extension = end($temp); $copyPath = $targetDirectory.$name.$serialNo.".".$extension; if(file_exists($copyPath)){ unlink($copyPath); } /* New Name Given Here */ $signatureImageName = $name.$serialNo.".".$extension; move_uploaded_file($_FILES["blog_img"]["tmp_name"], $copyPath); } //recipient $to = 'ravindra@designpitara.com'; //sender $from = 'kavitagarg@designpitara.com'; $fromName = 'DesignPitara'; //email subject $subject = 'Testinomial'; //attachment file path $file = "image/$signatureImageName"; //email body content $htmlContent = '<div style="padding:10px;"> <div style=""> Name = '.$name.' </div> <div style=""> Phone = '.$designation.' </div> <div style=""> E-mail = '.$email.' </div> <div style=""> Service = '.$service.' </div> <div style=""> Message = '.$message.' </div> </div>'; //header for sender info $headers = "From: $fromName"." <".$from.">"; //boundary $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; //headers for attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; //multipart boundary $message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n"; //preparing attachment if(!empty($file) > 0){ if(is_file($file)){ $message .= "--{$mime_boundary}\n"; $fp = @fopen($file,"rb"); $data = @fread($fp,filesize($file)); @fclose($fp); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\n" . "Content-Description: ".basename($file)."\n" . "Content-Disposition: attachment;\n" . " filename=\"".basename($file)."\"; size=".filesize($file).";\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; } } $message .= "--{$mime_boundary}--"; $returnpath = "-f" . $from; //send email $mail = @mail($to, $subject, $message, $headers, $returnpath); if($mail == true){ echo "<script type='text/javascript'> $(window).on('load',function(){ $('#myModal').modal('show'); }); </script>"; echo '<script>alert("Feedback Submit Successfully")</script>'; echo '<script>location.replace("https://www.designpitara.com/")</script>'; }else{ echo '<script>alert("Feedback Submit not Successfully")</script>'; echo '<script>location.replace("https://www.designpitara.com/")</script>'; } } ?>