1

Topic: CRLF / LF error on send - punBB 1.2.5

When I try to send mail using the form, I get the error:

An error was encountered
Error: Unable to send e-mail. Please contact the forum administrator with the following error message
reported by the SMTP server: "451 See http://pobox.com/~djb/docs/smtplf.html. ".

I've even tried to comment out

        if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
                $eol = "\r\n";
        else if (strtoupper(substr(PHP_OS, 0, 3) == 'MAC'))
                $eol = "\r";
        else
                $eol = "\n";

From includes/mail.php and just set $eol to \n but no go.

I suspect my users can't even register themselves at the moment either... Anyone know what I can do?

Any technology distinguishable from magic, is insufficiently advanced.
Official Danish mirror for punbb: http://mirror.ordo.dk/punbb.org/

Re: CRLF / LF error on send - punBB 1.2.5

What if you try setting it to \r\n? The problem is that the mail server doesn't like bare linefeeds.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: CRLF / LF error on send - punBB 1.2.5

Doh! You're right. I commented out the other stuff and just set $eol to \r\n - My memory failed me there. Seems to work now!

Any technology distinguishable from magic, is insufficiently advanced.
Official Danish mirror for punbb: http://mirror.ordo.dk/punbb.org/

Re: CRLF / LF error on send - punBB 1.2.5

I will make this an admin option in 1.3. The problem is that people sometimes run the forums on windows and the mail server on *nix (or vice versa). That's probably what you're doing, right?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5

Re: CRLF / LF error on send - punBB 1.2.5

No. Linux all the way, point is that it should always be \r\n and never \r or \n by themselves...
In my opinion you should just comply to the 822bis specification, and let mail hosters worry about their software doing it wrong smile Even mail server software that accepts \n.\n as End-Of-Mail is wrong... You should just replace lines 79-84 with $eol = "\r\n";

Any technology distinguishable from magic, is insufficiently advanced.
Official Danish mirror for punbb: http://mirror.ordo.dk/punbb.org/

Re: CRLF / LF error on send - punBB 1.2.5

Well, that's the way it worked before, but that resulted in people reporting it as a bug smile

"Programming is like sex: one mistake and you have to support it for the rest of your life."

7

Re: CRLF / LF error on send - punBB 1.2.5

Odd. This is actually the second time I have this problem. Both times are because punBB is set to send \n for linux...

Mail servers not complying to the standard are either extremely old or very bad and unknown wink The list from DJB's site is very short: http://cr.yp.to/docs/smtplf.html Solaris 2.5 sendmail, Eudora Pro 4.0 for Windows, listproc 6.0c, fetchmail, Galacticom WorldGroups, Claris Emailer and CipherTrust's IronMail SMTP gateway are reported to misbehave. And at least 3 of them are fixed with recent versions wink

Any technology distinguishable from magic, is insufficiently advanced.
Official Danish mirror for punbb: http://mirror.ordo.dk/punbb.org/

Re: CRLF / LF error on send - punBB 1.2.5

But those are the clients. The problem is on the server side. Apparently, some SMTP servers expect CRLF and some expect LF or CR. See this PHP bug report: http://bugs.php.net/bug.php?id=15841

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: CRLF / LF error on send - punBB 1.2.5

Hi Guys,

I am also getting this 451 thingy, and since I am coding "illiterate", could someone help in providing me the fix or the (code) string to fix (i suppose) in the includes/mail.php??

Please help? I'm lost....

Re: CRLF / LF error on send - punBB 1.2.5

Try commenting out these lines in include/email.php

        // Change the linebreaks used in the headers according to OS
        if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC')
            $headers = str_replace("\r\n", "\r", $headers);
        else if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
            $headers = str_replace("\r\n", "\n", $headers);

11

Re: CRLF / LF error on send - punBB 1.2.5

Smartys wrote:

Try commenting out these lines in include/email.php

        // Change the linebreaks used in the headers according to OS
        if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC')
            $headers = str_replace("\r\n", "\r", $headers);
        else if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
            $headers = str_replace("\r\n", "\n", $headers);

Hi Smarty,

Thanks for the quick reply and to supplying me the code fix!!! I will just COPY the intire code above and replace it into my "email.php" file.

I'll let you know...... THANK YOU SO MUCH!!! smile:)

Re: CRLF / LF error on send - punBB 1.2.5

err, I said comment them out (as in put // in front of each line) hmm

13

Re: CRLF / LF error on send - punBB 1.2.5

opps SORRY!......OKE DOKE!!

tHXS!

14

Re: CRLF / LF error on send - punBB 1.2.5

Hi Smarty,

I am using punbb 1.2.6 and I cannot seem to find this in my email.php:

// Change the linebreaks used in the headers according to OS
        if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC')
            $headers = str_replace("\r\n", "\r", $headers);
        else if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
            $headers = str_replace("\r\n", "\n", $headers);


This is what I found though in my email.php instead:

// Detect what linebreak we should use for the headers
    if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
        $eol = "\r\n";
    else if (strtoupper(substr(PHP_OS, 0, 3) == 'MAC'))
        $eol = "\r";
    else
        $eol = "\n";


Any idea's??

Re: CRLF / LF error on send - punBB 1.2.5

Aha, my code was from 1.2.14 wink

After the lines you found, paste

$eol=  "\r\n";

You should really upgrade btw

16

Re: CRLF / LF error on send - punBB 1.2.5

Hi Smarty,

Thanks for the reply!... Ok, I will give it a try again...thxs!

And yes, I should upgrade though.

smile

17

Re: CRLF / LF error on send - punBB 1.2.5

Smartys wrote:

Aha, my code was from 1.2.14 wink

After the lines you found, paste

$eol=  "\r\n";

You should really upgrade btw

HI SMARTY,

THAT WAS THE "TICKET!!! ALL FIXED NOW!!!! EVERYTHING WORKS FINE!!!

YOU DA BOMB!!! smile

THANKS VERY MUCH!!!

cool