[PHP] SMTP-access with PHP...

2001-06-20 Thread Magnus Hammar

Hello!

Why do I get this error (Relaying denied ) from my SMTP-server and how do I
make it work?

220 mail.server.com ESMTP Sendmail 8.9.3/8.9.3; Wed, 20 Jun 2001 15:09:06
+0200 (CEST) 
250 mail.server.com Hello localhost [127.0.0.1], pleased to meet you
250 [EMAIL PROTECTED] Sender ok
550 [EMAIL PROTECTED] Relaying denied
503 Need RCPT (recipient)

Is there something else I can do to make it work?
I use this code:
-
$smtp_server = localhost;
$port_number= 25;
$smtp_connection= fsockopen($smtp_server, $port_number);
if(!$smtp_connection){
$smtp_connection= fopen($smtp_server.:$port_number,w);
}
if(!$smtp_connection){
$return_value = SMTP-server not responding!;
return 0;
}else{
fputs($smtp_connection, );
$return_value = $return_value.fgets($smtp_connection,128).br;
fputs($smtp_connection, HELO $smtp_server\n);
$return_value = $return_value.fgets($smtp_connection,128).br;
fputs($smtp_connection, );
fputs($smtp_connection, MAIL FROM: $from\n);
$return_value = $return_value.fgets($smtp_connection,128).br;
fputs($smtp_connection, );
fputs($smtp_connection, RCPT TO: $till\n);
$return_value = $return_value.fgets($smtp_connection,128).br;
fputs($smtp_connection, );
fputs($smtp_connection, DATA\n);
$return_value = $return_value.fgets($smtp_connection,128).br;
fputs($smtp_connection, Subject: $subjekt\n);
fputs($smtp_connection, Reply-To: $from\n);
fputs($smtp_connection, MIME-Version: 1.0\n);
fputs($smtp_connection, Content-Type: text/plain; charset=iso-8859-1\n);
fputs($smtp_connection, Content-Transfer-Encoding: 8bit\n);
fputs($smtp_connection, X-mailer: Magnus Mail);
fputs($smtp_connection, \n\n);
fputs($smtp_connection, $bodyn\n\r);
fputs($smtp_connection, );
$return_value = $return_value.fgets($smtp_connection,128).br;
fputs($smtp_connection, );
fputs($smtp_connection, QUIT\n\r);
$return_value = $return_value.fgets($smtp_connection,128).br;
fclose($smtp_connection);
return $return_value;


/Magnus Hammar
--




Re: [PHP] SMTP-access with PHP...

2001-06-20 Thread Andreas D. Landmark

At 20.06.2001 14:16, you wrote:
Hello!

Why do I get this error (Relaying denied ) from my SMTP-server and how do I
make it work?

220 mail.server.com ESMTP Sendmail 8.9.3/8.9.3; Wed, 20 Jun 2001 15:09:06
+0200 (CEST)
250 mail.server.com Hello localhost [127.0.0.1], pleased to meet you
250 [EMAIL PROTECTED] Sender ok
550 [EMAIL PROTECTED] Relaying denied
503 Need RCPT (recipient)

snip-code
It's not anything wrong with your code, it's the fact that your mailserver 
doesn't allow
relay from the IP you're connecting with. If you are connecting on loopback 
there's
something serious strange with your mailserver config (but we're talking 
sendmail
here, what d'ya expect?).

Contact your mailserver admin and get him/her to open for relay from the IP 
of your
webserver.


-- 
Andreas D Landmark / noXtension
Real Time, adj.:
 Here and now, as opposed to fake time, which only occurs there
and then.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] SMTP-access with PHP...

2001-06-20 Thread Ed Brady

The SMTP server that you are using is more then likely configured to deny
sending if the e-mail does not originate from the domain the SMTP server is
used for.  This is done mainly to keep spammers from using the server as an
open relay and spewing junk mail all over the internet

Sometimes system admins will also exclude localhost because they believe
that no e-mail should be originating from the mail server itselfIf
the e-mail destination is in the domain that this server receives e-mail for
it will usually be accepted, otherwise depending upon it's ruleset, it will
be denied.

Your options are this...

1.   Your SMTP server may require authentication before it will allow you to
relay.  If so then you will need to authenticate yourself as a user, and
then it should allow you to relay.

2.If you do not have control of the SMTP server configuration, contact
your system admin and see if you can work out a method for you to get the
configuration modified to allow you to relay, or if there are other options
for relaying.

3.  If you have control of the SMTP server, and it is on a RedHat 7.1
machine, read the release notes.  In 7.1 RedHat made the sendmail daemon
work more or less in receive-only mode (it can be reconfigured to work
correctly). If it is not a RedHat box, you will need to reconfigure it to
allow relaying...  Directions on how to do this can be obtained from
www.sendmail.org, or by watching the comp.mail.sendmail newsgroup.  ( NOTE:
I highly recommend reading the manual and the FAQ before posting a question
to the newsgroup,  typically you will get flamed if you do not. )

Ed Brady
[EMAIL PROTECTED]

To reply, you know what to remove

- Original Message -
From: Magnus Hammar [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 20, 2001 9:16 AM
Subject: [PHP] SMTP-access with PHP...


 Hello!

 Why do I get this error (Relaying denied ) from my SMTP-server and how do
I
 make it work?
 
 220 mail.server.com ESMTP Sendmail 8.9.3/8.9.3; Wed, 20 Jun 2001 15:09:06
 +0200 (CEST)
 250 mail.server.com Hello localhost [127.0.0.1], pleased to meet you
 250 [EMAIL PROTECTED] Sender ok
 550 [EMAIL PROTECTED] Relaying denied
 503 Need RCPT (recipient)

 Is there something else I can do to make it work?
 I use this code:
 -
 $smtp_server = localhost;
 $port_number= 25;
 $smtp_connection= fsockopen($smtp_server, $port_number);
 if(!$smtp_connection){
 $smtp_connection= fopen($smtp_server.:$port_number,w);
 }
 if(!$smtp_connection){
 $return_value = SMTP-server not responding!;
 return 0;
 }else{
 fputs($smtp_connection, );
 $return_value = $return_value.fgets($smtp_connection,128).br;
 fputs($smtp_connection, HELO $smtp_server\n);
 $return_value = $return_value.fgets($smtp_connection,128).br;
 fputs($smtp_connection, );
 fputs($smtp_connection, MAIL FROM: $from\n);
 $return_value = $return_value.fgets($smtp_connection,128).br;
 fputs($smtp_connection, );
 fputs($smtp_connection, RCPT TO: $till\n);
 $return_value = $return_value.fgets($smtp_connection,128).br;
 fputs($smtp_connection, );
 fputs($smtp_connection, DATA\n);
 $return_value = $return_value.fgets($smtp_connection,128).br;
 fputs($smtp_connection, Subject: $subjekt\n);
 fputs($smtp_connection, Reply-To: $from\n);
 fputs($smtp_connection, MIME-Version: 1.0\n);
 fputs($smtp_connection, Content-Type: text/plain; charset=iso-8859-1\n);
 fputs($smtp_connection, Content-Transfer-Encoding: 8bit\n);
 fputs($smtp_connection, X-mailer: Magnus Mail);
 fputs($smtp_connection, \n\n);
 fputs($smtp_connection, $bodyn\n\r);
 fputs($smtp_connection, );
 $return_value = $return_value.fgets($smtp_connection,128).br;
 fputs($smtp_connection, );
 fputs($smtp_connection, QUIT\n\r);
 $return_value = $return_value.fgets($smtp_connection,128).br;
 fclose($smtp_connection);
 return $return_value;


 /Magnus Hammar
 --



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] SMTP-access with PHP...

2001-06-20 Thread Magnus

Den 01-06-20 18.28, skrev Andreas D. Landmark
[EMAIL PROTECTED]:

 Contact your mailserver admin and get him/her to open for relay from the IP
 of your
 webserver.

Thanks, I'll try that and see what will happen.

Sincerely,
/Magnus Hammar
--


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]