+ Reply to Thread
Results 1 to 1 of 1
Thread: php mail script
-
Administrator
- Join Date
- Mar 2010
- Posts
- 76
php mail script
Hello Guys
,
php mail script
You should install following pear modules.
pear install Net_SMTP
pear install Mail
<?php
require_once "Mail.php";
$from = "Name Sender <email@domain.com>";
$to = "Receive Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.domain.com";
$username = "email@domain.com";
$password = "email_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>");
}
?>
----------------
If no authentication needed. Just send as nobody using a script, use below.
<?
mail("email@domain.com", "My Subject", "Line 1\nLine 2\nLine 3");
?>
===================E N D============================


LinkBack URL
About LinkBacks



Reply With Quote