Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. include 'Mail.php';
  2. $host = 'smtp.ok.pt';
  3. $from = 'quem@ola.pt';
  4. $username = 'ehehe';
  5. $password = 'fkfkjf';
  6. $to = 'bla@cospelonge.pt';
  7. $cc = 'maisum@bolas.pt,outro@bolas.pt';
  8. $bcc = 'ai@chatice.pt';
  9. $body = 'teste';
  10. $body = utf8_decode($body);
  11. $subject = utf8_decode('c\'est lavie en rose');
  12. $crlf = "\n";
  13. $recipients = $to . ", " . $cc . ", " . $bcc;
  14. $headers = array('From' => $from, 'To' => $to, 'Cc' => $cc, 'Bcc' => $bcc, 'Subject' => $subject);
  15. $smtp = Mail::factory('smtp',array('host' => $host,
  16. 'port' => 465, // SMTPS
  17. 'auth' => true,'debug' => true,
  18. 'username' => $username,
  19. 'password' => $password)
  20. );
  21. $mail = $smtp->send($recipients, $headers, $body);
  22. if (PEAR::isError($mail)) {
  23. error_log($mail->getMessage());
  24. } else {
  25. echo "Enviado com sucesso";
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement