<?php 
 

require("class.phpmailer.php");

$mail       = new PHPMailer();

//收件人地址
//$address    = $_POST['address'];
$address    = "support@gilisoft.com";

$uploadfile1 = $_POST['uploadfile1'];

$uploadfile2 = $_POST['uploadfile2'];

$Subject    = $_POST['subject'];
 

 


$Body       = $_POST['content'];

 echo "Body:".$Body;

//$smtpname   = $_POST['smtpname'];
$smtpname   = "mail.gilisoft.com";

//$myaddress  = $_POST['myaddress'];
$myaddress  = "support@gilisoft.com";

//$password   = $_POST['password'];
$password   = "HDkdw4hQPfU7";

//$myname     = $_POST['myname'];
$myname     = $_POST['myname'];

	
$userpic = $uploadfile1;
$userlog = $uploadfile2;

$path1 = "./temp/".$userpic;
$path2 = "./temp/".$userlog;

// echo $path;

$mail->IsSMTP();             // set mailer to use SMTP
$mail->Host     =$smtpname;  // specify main and backup server
$mail->SMTPAuth =true;       // turn on SMTP authentication
$mail->Username =$myaddress; // SMTP username
$mail->Password =$password;  // SMTP password
$mail->From     =$myaddress; 
$mail->FromName =$myname;   
$mail->AddAddress("$address","");
$mail->AddReplyTo($_POST['myaddress'], $_POST['myaddress']);    //回复地址



if (file_exists($path1))
{
  $mail->AddAttachment("./temp/".$userpic); // add attachments
}
 
if (file_exists($path2))
{
  $mail->AddAttachment("./temp/".$userlog); // add attachments
}
 

$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $Subject;
$mail->Body    = $Body;
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
   if (file_exists($path1))
    {
      unlink($path1);
    }
  if (file_exists($path2))
    {
      unlink($path2);
    }
    echo $mail->ErrorInfo;

    echo "/n邮件无法发送";
    exit;
}
if (file_exists($path1))
{
    unlink($path1);
}
if (file_exists($path2))
{
  unlink($path2);
}

echo "/n邮件发送成功";

?>
