Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.87 KB | None | 0 0
  1. <?php
  2. session_start();
  3. //Make sure that the input come from a posted form. Otherwise quit immediately
  4. if ($_SERVER["REQUEST_METHOD"] <> "POST")
  5. die("You can only reach this page by posting from the html form");
  6. //error_reporting(E_ALL);
  7. error_reporting(E_STRICT);
  8.  
  9. date_default_timezone_set('America/Toronto');
  10.  
  11. include("class.phpmailer.php");
  12. //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
  13.  
  14.  
  15.  
  16.  
  17. $mail             = new PHPMailer();
  18. $ipAdd      = $_SERVER["REMOTE_ADDR"];
  19. $name       = $_REQUEST['name'];
  20. $taikhoan   = $_REQUEST['taikhoan'];
  21. $email      = $_REQUEST['email'];
  22. $mailTo     = 'acclp.003@gmail.com';
  23. $receiver   = 'Support Team';
  24. $subj       = $_REQUEST["subject"];
  25. $mess       = $_REQUEST['message'];
  26. $captcha    = $_SESSION["security_code"];
  27. $body             = "<p>"
  28.                     . "<fieldset style='border:1px solid #afe14c;margin: 5px 0;padding: 20px 10px'>"
  29.                     ."<legend style='font: 700 14px Arial, Helvetica, sans-serif;padding: 0 5px;margin: 0 10px;color: #73b304'>Thông tin</legend>"
  30.                     . "+ Tài khoản: <b>".$taikhoan."</b><br><br>"
  31.                     . "+ Họ tên: <b>".$name."</b><br><br>"
  32.                     . "+ Email: <b>".$email."</b><br><br>"
  33.                     . "+ Địa chỉ Ip: <b><a href=\"http://www.ip-adress.com/ip_tracer/".$ipAdd."\" target=\"_blank\">".$ipAdd."</a></b><br>"
  34.                     ."</fieldset>"
  35.                     . "<fieldset style='border:1px solid #afe14c;margin: 5px 0;padding: 20px 10px'>"
  36.                     ."<legend style='font: 700 14px Arial, Helvetica, sans-serif;padding: 0 5px;margin: 0 10px;color: #73b304'>Nội dung</legend>"
  37.                     .$mess
  38.                     ."</fieldset>"
  39.                     ."</p>";
  40. $body             = eregi_replace("[\]",'',$body);
  41.  
  42. $mail->CharSet = 'utf-8';
  43. $mail->IsSMTP();
  44. $mail->SMTPAuth   = true;                  // enable SMTP authentication
  45. //$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
  46. $mail->Host       = "smtp.sendgrid.net";      // sets GMAIL as the SMTP server
  47. $mail->Port       = 25;                   // set the SMTP port for the GMAIL server
  48. $mail->Username   = "azdigi_huytran";  // GMAIL username
  49. $mail->Password   = "azdigihuytran123";            // GMAIL password
  50.  
  51. //$mail->AddReplyTo("","First Last");
  52.  
  53. //$mail->From       = "";
  54. $mail->FromName   = $name;
  55.  
  56. $mail->Subject    = $subj;
  57.  
  58. //$mail->Body       = "Hi,<br>This is the HTML BODY<br>";                      //HTML Body
  59. //$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  60. $mail->WordWrap   = 50; // set word wrap
  61.  
  62. $mail->MsgHTML($body);
  63.  
  64. $mail->AddAddress($mailTo, $receiver);
  65.  
  66. //$mail->AddAttachment("img/t_c.gif");             // attachment
  67.  
  68. $mail->IsHTML(true); // send as HTML
  69. sleep(1);
  70.  
  71. if($_REQUEST["spamcheck"] <> $captcha){
  72.     echo "errorCode";
  73. }
  74. else{
  75.     if(!$mail->Send()) {
  76.       echo "Mailer Error: " . $mail->ErrorInfo;
  77.     } else {
  78.         echo("sended");
  79.     }
  80. }
  81. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement