Инсталим
PEAR Mail,
Pear mime и
Pear Net_SMTP
pear install mail
pear install net_smtp
pear install mail_mime
И отправляем из php без всяких sendmail
require_once ('Mail.php'); // PEAR Mail package
require_once ('mime.php'); // PEAR Mail_Mime packge
$from = "sender@example.com";
$to = "recipient@example.com";
$subject = 'SUBJECT';
$headers = array ('From' => $from,'To' => $to, 'Subject' => $subject);
$text = 'TEXT'; // text and html versions of email.
$crlf = "\n";
$mime = new Mail_mime($crlf);
$host = "smtp.example.com";
$username = "user@example.com";
$password = "pass";
$smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true,
'username' => $username,'password' => $password));
$mime->setTXTBody($text);
$body = $mime->get();
$headers = $mime->headers($headers);
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
}
else {
echo("<p>Message successfully sent!</p>");
}