PHP sendmail
<?
$t=mail('my@mail.ru', 'tema', 'mess');
print $t;
?>
Выводит 1 типа все ок, но никакое письмо не приходит(
Стоят Apache 2.0.47, PHP 4.3.3, Linux Slackware 9.0
Sendmail из дистрибутива стоит, настройки я не менял, в php.ini так же все по умолчанию.
Самое странное что такая же конструкция на Mandrake 9.1 работает на ура. В чем проблема подскажите пожалуйста.
Код:
mail($mailto, $subject, $message, "From: $mailfrom\r\n"."Reply-To: $mailfrom\r\n"."Bcc: $copy_mail\r\n","-fhello@mail.ru")
Если не получится -- попробуй соединиться с mail сервером через сокет (из мана):
Код:
<?php
function socketmail($toArray, $subject, $message) {
// $toArray format --> array("Name1" => "address1", "Name2" => "address2", ...)
ini_set(sendmail_from, "myemail@address.com");
$connect = fsockopen (ini_get("SMTP"), ini_get("smtp_port"), $errno, $errstr, 30) or die("Could not talk to the sendmail server!");
$rcv = fgets($connect, 1024);
fputs($connect, "HELO {$_SERVER['SERVER_NAME']}\r\n");
$rcv = fgets($connect, 1024);
while (list($toKey, $toValue) = each($toArray)) {
fputs($connect, "MAIL FROM:myemail@address.com\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "RCPT TO:$toValue\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "DATA\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "Subject: $subject\r\n");
fputs($connect, "From: My Name <myemail@address.com>\r\n");
fputs($connect, "To: $toKey <$toValue>\r\n");
fputs($connect, "X-Sender: <myemail@address.com>\r\n");
fputs($connect, "Return-Path: <myemail@address.com>\r\n");
fputs($connect, "Errors-To: <myemail@address.com>\r\n");
fputs($connect, "X-Mailer: PHP\r\n");
fputs($connect, "X-Priority: 3\r\n");
fputs($connect, "Content-Type: text/plain; charset=iso-8859-1\r\n");
fputs($connect, "\r\n");
fputs($connect, stripslashes($message)." \r\n");
fputs($connect, ".\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "RSET\r\n");
$rcv = fgets($connect, 1024);
}
fputs ($connect, "QUIT\r\n");
$rcv = fgets ($connect, 1024);
fclose($connect);
ini_restore(sendmail_from);
}
?>
function socketmail($toArray, $subject, $message) {
// $toArray format --> array("Name1" => "address1", "Name2" => "address2", ...)
ini_set(sendmail_from, "myemail@address.com");
$connect = fsockopen (ini_get("SMTP"), ini_get("smtp_port"), $errno, $errstr, 30) or die("Could not talk to the sendmail server!");
$rcv = fgets($connect, 1024);
fputs($connect, "HELO {$_SERVER['SERVER_NAME']}\r\n");
$rcv = fgets($connect, 1024);
while (list($toKey, $toValue) = each($toArray)) {
fputs($connect, "MAIL FROM:myemail@address.com\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "RCPT TO:$toValue\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "DATA\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "Subject: $subject\r\n");
fputs($connect, "From: My Name <myemail@address.com>\r\n");
fputs($connect, "To: $toKey <$toValue>\r\n");
fputs($connect, "X-Sender: <myemail@address.com>\r\n");
fputs($connect, "Return-Path: <myemail@address.com>\r\n");
fputs($connect, "Errors-To: <myemail@address.com>\r\n");
fputs($connect, "X-Mailer: PHP\r\n");
fputs($connect, "X-Priority: 3\r\n");
fputs($connect, "Content-Type: text/plain; charset=iso-8859-1\r\n");
fputs($connect, "\r\n");
fputs($connect, stripslashes($message)." \r\n");
fputs($connect, ".\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "RSET\r\n");
$rcv = fgets($connect, 1024);
}
fputs ($connect, "QUIT\r\n");
$rcv = fgets ($connect, 1024);
fclose($connect);
ini_restore(sendmail_from);
}
?>
Короче я так зделал