Guest User

Untitled

a guest
Feb 19th, 2018
2,093
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. $url = "https://mail.zoho.com/api/accounts/662704xxx/messages";
  2. $param = [ "fromAddress"=> "myemail@mydomain.com",
  3. "toAddress"=> "somewhere@gmail.com",
  4. "ccAddress"=> "",
  5. "bccAddress"=> "",
  6. "subject"=> "Email - Always and Forever",
  7. "content"=> "Email can never be dead ..."];
  8. $ch = curl_init();
  9. curl_setopt($ch, CURLOPT_URL, $url);
  10. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  12. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  13. curl_setopt($ch, CURLOPT_POST, 1);
  14. curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($param));
  15. $result = curl_exec($ch);
  16. curl_close($ch);
  17. print_r($result);
  18. die;
  19.  
  20. {"data":{"errorCode":"INVALID_TICKET","moreInfo":"Invalid ticket"},"status":{"code":400,"description":"Invalid Input"}}
  21.  
  22. <?php
  23. use PHPMailerPHPMailerPHPMailer;
  24.  
  25. $phpMailer = new PHPMailer(true);
  26. $phpMailer->isSMTP();
  27. $phpMailer->Host = "smtp.zoho.com";
  28. $phpMailer->SMTPAuth = true;
  29. $phpMailer->Username = "your-user";
  30. $phpMailer->Password = "your-password";
  31. $phpMailer->SMTPSecure = "tls";
  32. $phpMailer->Port = 587;
  33. $phpMailer->isHTML(true);
  34. $phpMailer->CharSet = "UTF-8";
  35. $phpMailer->setFrom("mail-user", "mail-name");
  36.  
  37. $phpMailer->addAddress("mail-to");
  38. $phpMailer->Subject = "subject";
  39. $phpMailer->Body = "mail-body";
  40. $phpMailer->send();
Add Comment
Please, Sign In to add comment