RATA
Новичок
пакет PEAR::Net_SMTP
Доброго времени суток!
Вообщем возникла такая проблема:
вот код, который я использую для соединения с почтовым сервером и отправляю на ящик письмо, посредство пакета Net_SMTP
<?
require_once('Net/SMTP.php');
$host = 'mail.farline.net';
$from = '[email protected]';
$rcpt = array('[email protected]');
$subj = "Subject: Test Message\n";
$body = "Body Line 1\nBody Line 2";
/* Create a new Net_SMTP object. */
if (! ($smtp = new Net_SMTP($host))) {
die("Unable to instantiate Net_SMTP object\n");
}
$smtp->setDebug(true);
/* Connect to the SMTP server. */
if (PEAR::isError($e = $smtp->connect())) {
die($e->getMessage() . "\n");
}
/* Send the 'MAIL FROM:' SMTP command. */
if (PEAR::isError($smtp->mailFrom($from))) {
die("Unable to set sender to <$from>\n");
}
/* Address the message to each of the recipients. */
foreach ($rcpt as $to) {
if (PEAR::isError($res = $smtp->rcptTo($to))) {
die("Unable to add recipient <$to>: " . $res->getMessage() . "\n");
}
}
/* Set the body of the message. */
if (PEAR::isError($smtp->data($subj . "\r\n" . $body))) {
die("Unable to send data\n");
}
/* Disconnect from the SMTP server. */
$smtp->disconnect();
?>
Включен дебаг ($smtp->setDebug(true)) и он выдает такие данные:
DEBUG: Recv: 220 mail.farline.net ESMTP Postfix (Debian/GNU)
DEBUG: Send: EHLO localhost
DEBUG: Recv: 250-mail.farline.net
DEBUG: Recv: 250-PIPELINING
DEBUG: Recv: 250-SIZE 10240000
DEBUG: Recv: 250-ETRN
DEBUG: Recv: 250-STARTTLS
DEBUG: Recv: 250-AUTH LOGIN PLAIN
DEBUG: Recv: 250 8BITMIME
DEBUG: Send: MAIL FROM:<[email protected]>
DEBUG: Recv: 250 Ok
DEBUG: Send: RCPT TO:<[email protected]>
DEBUG: Recv: 554 <[email protected]>: Relay access denied
Unable to add recipient <[email protected]>: Invalid response code received from server
Что тут не так с получателем - я не могу понять, с почтовым сервером все нормально.
В нете вообще толком нет документации по PEAR::Net_SMTP, кроме того, что я нашел
http://cvs.php.net/viewvc.cgi/pear/Net_SMTP/docs/examples/basic.php?revision=1.1&view=markup
Может кто-то сталкивался с этой проблемой и поможет разобраться? Заранее благодарю!
Доброго времени суток!
Вообщем возникла такая проблема:
вот код, который я использую для соединения с почтовым сервером и отправляю на ящик письмо, посредство пакета Net_SMTP
<?
require_once('Net/SMTP.php');
$host = 'mail.farline.net';
$from = '[email protected]';
$rcpt = array('[email protected]');
$subj = "Subject: Test Message\n";
$body = "Body Line 1\nBody Line 2";
/* Create a new Net_SMTP object. */
if (! ($smtp = new Net_SMTP($host))) {
die("Unable to instantiate Net_SMTP object\n");
}
$smtp->setDebug(true);
/* Connect to the SMTP server. */
if (PEAR::isError($e = $smtp->connect())) {
die($e->getMessage() . "\n");
}
/* Send the 'MAIL FROM:' SMTP command. */
if (PEAR::isError($smtp->mailFrom($from))) {
die("Unable to set sender to <$from>\n");
}
/* Address the message to each of the recipients. */
foreach ($rcpt as $to) {
if (PEAR::isError($res = $smtp->rcptTo($to))) {
die("Unable to add recipient <$to>: " . $res->getMessage() . "\n");
}
}
/* Set the body of the message. */
if (PEAR::isError($smtp->data($subj . "\r\n" . $body))) {
die("Unable to send data\n");
}
/* Disconnect from the SMTP server. */
$smtp->disconnect();
?>
Включен дебаг ($smtp->setDebug(true)) и он выдает такие данные:
DEBUG: Recv: 220 mail.farline.net ESMTP Postfix (Debian/GNU)
DEBUG: Send: EHLO localhost
DEBUG: Recv: 250-mail.farline.net
DEBUG: Recv: 250-PIPELINING
DEBUG: Recv: 250-SIZE 10240000
DEBUG: Recv: 250-ETRN
DEBUG: Recv: 250-STARTTLS
DEBUG: Recv: 250-AUTH LOGIN PLAIN
DEBUG: Recv: 250 8BITMIME
DEBUG: Send: MAIL FROM:<[email protected]>
DEBUG: Recv: 250 Ok
DEBUG: Send: RCPT TO:<[email protected]>
DEBUG: Recv: 554 <[email protected]>: Relay access denied
Unable to add recipient <[email protected]>: Invalid response code received from server
Что тут не так с получателем - я не могу понять, с почтовым сервером все нормально.
В нете вообще толком нет документации по PEAR::Net_SMTP, кроме того, что я нашел
http://cvs.php.net/viewvc.cgi/pear/Net_SMTP/docs/examples/basic.php?revision=1.1&view=markup
Может кто-то сталкивался с этой проблемой и поможет разобраться? Заранее благодарю!