Advertisement
Guest User

Untitled

a guest
Sep 1st, 2017
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. $from = "no-reply@mydomain.net";
  2. $port = "587";
  3. $to=$d_uname;
  4. $host = "smtp.sendgrid.net";
  5. $username = "username";
  6. $password = "password";
  7.  
  8. $headers = array ('From' => $d_replyto,
  9. 'To' => $to,
  10. 'Subject' => $d_subject,
  11. 'MIME-Version' => "1.0",
  12. 'Content-type' => "text/plain; charset=utf-8",
  13. );
  14. $smtp = Mail::factory('smtp',
  15. array ('host' => $host,
  16. 'port' => $port,
  17. 'auth' => true,
  18. 'username' => $username,
  19. 'password' => $password));
  20.  
  21. #Email it
  22. if (PEAR::isError($smtp)) {
  23. error_log("<p>" . $smtp->getMessage() . "</p>");
  24. }
  25. $mail = $smtp->send($to, $headers, $d_message);
  26.  
  27. authentication failure [SMTP: STARTTLS failed (code: 220, response: Begin TLS negotiation now)]
  28.  
  29. else{ // if $fp does exist
  30. stream_context_set_option($fp, 'ssl', 'verify_peer', false);
  31. stream_context_set_option($fp, 'ssl', 'allow_self_signed', true);
  32. stream_context_set_option($fp, 'ssl', 'verify_peer_name', false);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement