Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form enctype="multipart/form-data" id="contact-form-cv" name="contact-form-cv" method="POST" data-name="Contact Form CV">
- <div class="form-group">
- <div class="controls">
- <!-- FILE -->
- <input type="hidden" name="MAX_FILE_SIZE" value="300000">
- <input type="file" name="cv-file" id="file" class="input-file form-control special-form my-file">
- <label for="file" class="btn btn-tertiary js-labelFile">
- <span class="js-fileName"><i class="fa fa-upload"></i> Attach CV*</span>
- </label>
- <!-- Button -->
- <button id="cv-valid-form" type="submit" class="btn btn-lg submit">Submit</button>
- </div>
- </div>
- <?php
- if($_POST) {
- date_default_timezone_set('Etc/UTC');
- // require_once('phpmailer/PHPMailerAutoload.php');
- require_once ('phpmailer/PHPMailerAutoload.php');
- $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['cv-file']['name']));
- $mail = new PHPMailer();
- //Set PHPMailer to use SMTP.
- $mail->isSMTP();
- //Enable SMTP debugging.
- $mail->SMTPDebug = 0;
- //Ask for HTML-friendly debug output
- $mail->Debugoutput = 'html';
- //Set SMTP host name
- $mail->Host = 'smtp.gmail.com';
- //Set TCP port to connect to
- $mail->Port = 587;
- //Set the encryption system to use - ssl (deprecated) or tls
- $mail->SMTPSecure = 'tls';
- //Set this to true if SMTP host requires authentication to send email
- $mail->SMTPAuth = true;
- $mail->isHTML(true);
- //Provide username and password yo your google account
- $mail->Username = "*******@gmail.com";
- $mail->Password = "*******";
- //Set who the message is to be sent from
- $mail->setFrom('******@gmail.com', 'Jony');
- //Set an alternative reply-to address
- // $mail->addReplyTo('replyto@example.com', 'First Last');
- //Set who the message is to be sent to
- $mail->addAddress('*****@gmail.com', 'John Doe');
- //Set the subject line
- $mail->Subject = 'New message from my website!';
- //Replace the plain text body with one created manually
- $mail->Body = 'hello' . "rn" ;
- $mail->addAttachment($uploadfile, 'UPLOAD file');
- if(!$mail->send())
- {
- $output = json_encode(array('type'=>'error', 'text' => '<i class="icon ion-close-round"></i> Oops! Looks like something went wrong, please check your PHP mail configuration.'));
- die($output);
- }
- else
- {
- $output = json_encode(array('type'=>'message', 'text' => '<i class="icon ion-checkmark-round"></i> Hello '.$_POST["userName"] .', Your message has been sent, we will get back to you asap !'));
- die($output);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment