note 39305 deleted from function.mail by sobak
| From: | sobak@php.net | Date: | Thu, 01 Dec 2016 17:28:06 +0000 |
| Subject: | note 39305 deleted from function.mail by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207888@lists.php.net to get a copy of this message | ||
Note Submitter: roberto dot silva at mexicoshipping dot net
----
If you can't use or don't understand how to use the sendmail program from linux, you can
use a PEAR object to send mail.
<?php
include("Mail.php");
$recipients = "mailto@example.com";
$headers["From"] = "mailfrom@example.com";
$headers["To"] = "mailto@example.com";
$headers["Subject"] = "Test message";
$body = "TEST MESSAGE!!!";
$params["host"] = "example.com";
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = "user";
$params["password"] = "password";
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", $params);
$mail_object->send($recipients, $headers, $body);
?>
In my case, i use a smtp server that require authentication, and sendmail configuration is almost
cryptic to me.
PEAR is already installed in PHP 4.0.3 , if not, you must go to http://pear.php.net/ and install it, in my case, I needed to add the
Socket.php to the PEAR library.