Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 820 Bytes

contact-form-script.md

File metadata and controls

36 lines (30 loc) · 820 Bytes

Contact form script:-

<?php
ini_set("include_path", '/home/username/php:' . ini_get("include_path"));
require_once "Mail.php";

$from = "Sandra Sender <[email protected]>";
$to = "Ramona Recipient <[email protected]>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "textus.serveradept.com";
$port = "25";
$username = "[email protected]";
$password = "]y#o~~=7bu+~";

$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'port' => $port,
    '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>");
 }
?>