There was a problem loading the comments.

PEAR: Sending mail from PHP.

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
  • 25 July 2007 6:05 PM

This sample uses the Pear Mail package. The package is already in the INCLUDE path.
http://pear.php.net/package/Mail

<?
include_once("Mail.php");

$recipients = '[email protected]';

$headers["From"] = '[email protected]';
$headers["To"] = '[email protected]';
$headers["Subject"] = "Test message";

$body = "TEST MESSAGE!!!";

$params["host"] = 'smtp.domainHosted'.com;
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = '[email protected]';
$params["password"] = "password";

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", $params);

$mail_object->send($recipients, $headers, $body);

echo "Email sent."
?>


These examples may not work for you without certain modifications.
The purpose of the examples is to give you a general idea on the topic.

Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  


Self-Hosted Help Desk Software by SupportPal
© Indichosts.net