PHP Script for new 2008 Windows Server

PHP Script for new 2008 Windows Server

<?php
require_once "Mail.php";

$from = "name Sender <mail@domain.com>";
$to = "name Recipient <mail@domain.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.domain.com";
$username = "smtp_username";
$password = "smtp_password";

$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
 } else {
  echo("<p>Message successfully sent!</p>");
 }
?>

Article ID: 2, Created On: 4/16/2013, Modified: 4/16/2013

Feedback (0)