<?php
require_once "Mail.php";
/**************************************************
EDIT the following variables for your own use
***************************************************/
$from = "Sender <sender@example.com>";
$to = "Recipient <recipient@example.com>";
$subject = "Hi!"; //type in subject here
$host = "mail.example.com"; // Your domain
$username = "smtp_username"; // Your user / full email address
$password = "smtp_password"; // Password to your email address
/**************************************************
***************************************************/
$body = "";
foreach($_POST as $a => $b)
{
$body .= $a .": ". $b . "\n";
}
$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)) {
/**************************************************
ERROR MESSAGE
***************************************************/
?>
<p> <? echo $mail->getMessage(); ?> </p>
<?
/**************************************************/
} else {
/**************************************************
SUCCESS MESSAGE
***************************************************/
?>
<p>Message successfully sent!</p>
<?
/**************************************************/
}
?> |