Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mailto = $_POST['mail_to'];
- $mailSub = $_POST['mail_sub'];
- $mailMsg = $_POST['mail_msg'];
- $attachment = $_FILES['attachment'];
- require 'PHPMailer-master/PHPMailerAutoload.php';
- $mail = new PHPMailer();
- $mail ->IsSmtp();
- $mail ->SMTPDebug = 1;
- $mail ->SMTPAuth = true;
- $mail ->SMTPSecure = 'ssl';
- $mail ->Host = "smtp.gmail.com";
- $mail ->Port = 465; // or 587
- $mail ->IsHTML(true);
- $mail ->Username = "#######@gmail.com";
- $mail ->Password = "########";
- $mail ->SetFrom("#######@gmail.com");
- $mail ->Subject = $mailSub;
- $mail ->Body = $mailMsg;
- $mail ->AddAddress($mailto);
- $mail ->AddAttachment($attachment);
- $file = "attachment/" . basename($_FILES['attachment']['name']);
- if(!$mail->Send())
- {
- echo "Mail Not Sent";
- }
- else
- {
- echo "Mail Sent";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement