Advertisement
Guest User

Untitled

a guest
Jun 1st, 2017
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. require_once "Mail.php";
  3.  
  4. $from = "FleksiWeb Salg <salg@fleksiweb.no>";
  5. $to = "Ruben Vaadahl <ruben.vaadahl@gmail.com>";
  6. $subject = "Test email using PHP SMTP";
  7. $body = "This is a test email message";
  8.  
  9. $host = "mail.fleksiweb.no";
  10. $username = "system@fleksiweb.no";
  11. $password = "Lama2010#";
  12.  
  13. $headers = array ('From' => $from,
  14.   'To' => $to,
  15.   'Subject' => $subject);
  16. $smtp = Mail::factory('smtp',
  17.   array ('host' => $host,
  18.     'auth' => true,
  19.     'username' => $username,
  20.     'password' => $password));
  21.  
  22. $mail = $smtp->send($to, $headers, $body);
  23.  
  24. if (PEAR::isError($mail)) {
  25.   echo("<p>" . $mail->getMessage() . "</p>");
  26.  } else {
  27.   echo("<p>Message successfully sent!</p>");
  28.  }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement