Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (array_key_exists('uploaded_file', $_FILES)) {
- require "PHPMailer-master/PHPMailerAutoload.php";
- $uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['uploaded_file']['tmp_name']));
- if (move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $uploadfile)) {
- $mail = new PHPMailer;
- $mail->isSMTP();
- // $mail->SMTPDebug = 2;
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = "tls";
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 587;
- /* $mail->Username = "noreplyemailar@gmail.com";
- $mail->Password = "N156Gsr4%";*/
- $mail->Username = "test.damiracle17@gmail.com";
- $mail->Password = "testdami123";
- $mail->From = "noreplyemailar@titagarh.in";
- $mail->AddAddress('mukesh.dayal@titagarh.in', 'mukesh');
- // $mail->AddAddress('anik.nag27@gmail.com', 'Anik Nag');
- $mail->isHTML(true);
- $mail->Subject = 'Customer Complaint Form';
- $mail->Body = $message;
- // Attach the uploaded file
- $mail->addAttachment($uploadfile,$_FILES['uploaded_file']['name']);
- if (!$mail->send()) {
- $msg .= "Mailer Error: " . $mail->ErrorInfo;
- } else {
- $msg .= "Message sent!";
- }
- } else {
- $msg .= 'Failed to move file to ' . $uploadfile;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement