Advertisement
Guest User

Untitled

a guest
Apr 10th, 2017
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $output[] = array('message' => '1');
  2.  
  3. // Start email
  4. $mail = new PHPMailer;
  5. $mail->isSMTP();
  6. $mail->SMTPDebug = 0;
  7. //$mail->Debugoutput = 'html';
  8. $mail->IsHTML(true);
  9. $mail->Host = 'smtp.gmail.com';
  10. $mail->Port = 587;
  11. $mail->SMTPSecure = 'tls';
  12. $mail->SMTPAuth = true;
  13. $mail->Username = "******";
  14. $mail->Password = "******";
  15. $mail->setFrom('mail@mail.com', 'Sender');
  16. $mail->addAddress('mail@mail.com', 'Receiver');
  17. $mail->Subject = 'Sent';
  18. //$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  19. $mail->AltBody = 'This is a plain-text message body';
  20. $mail->Body = 'Sent';
  21. //$mail->addAttachment('images/phpmailer_mini.png');
  22. if(!$mail->send()) {
  23. //echo json_encode(['status' => false, 'message' => 'Message could not be sent. Error: ' . $mail->ErrorInfo]);
  24. echo 'Email error' .$mail->ErrorInfo;
  25. }
  26. else
  27. {
  28. echo json_encode($output);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement