123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
-
- require_once ('PHPMailer_5.2.0/class.phpmailer.php');
-
- $position = $_POST["position"];
- $name = $_POST["full-name"];
- $email = $_POST["email"];
- $phone = $_POST["phone"];
- $address = $_POST["address"];
- $message = $_POST["message"];
-
- $resume = $_POST["resume"];
-
- $resume_file = $_FILES["resume-file"];
- $resume_name = $resume_file['name'];
- ob_start(); ?>
- <html>
- <head>
- <title>Apply</title>
- </head>
- <body>
- <table>
- <tr>
- <td colspan='2'><b><?php echo $position; ?> </b></td>
- </tr>
- <tr>
- <td>Name:</td>
- <td><?php echo $name; ?></td>
- </tr>
- <tr>
- <td>Email:</td>
- <td><a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></td>
- </tr>
- <tr>
- <td>Phone:</td>
- <td><?php echo $phone; ?></td>
- </tr>
-
- <tr>
- <td>Message:</td>
- <td><?php echo $message; ?></td>
- </tr>
-
- </table>
- </body>
- </html>
- <?php
- $msg = ob_get_clean();
-
-
- $mail = new PHPMailer();
- $mail->IsSMTP(); // telling the class to use SMTP
-
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = "tls"; // enable SMTP authentication
- $mail->Host = "mail.dilig.net";
- $mail->Port = 587;
- $mail->Username = "[email protected]"; // SMTP username
- $mail->Password = "contactus#dlgnt"; // SMTP password
- $mail->SetFrom($email, $name);
- $data = substr($resume, strpos($resume, ","));
- $filename = $resume_name;
- $encoding = "base64";
- //$type = "application/vnd.ms-excel";
- $type = substr( $resume , 6 , strpos($resume, ";") - 5);
- $mail->AddStringAttachment(base64_decode($data), $resume_name, $encoding, $type);
-
- $mail->addAttachment( $resume);
-
- $mail->Subject = "Apply for job " . $position;
-
- $mail->Body = $msg;
-
- $mail->AddAddress('[email protected]', "HR Diligent");
- $mail->IsHtml(true);
-
- $mail->send();
-
-
- echo json_encode($msg);
- ?>
|