Announcement

Collapse
No announcement yet.

RFC Compliance in email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RFC Compliance in email

    I am having to edit the functions.php and diagnostics.php to make them RFC complaint so that servers will email them. Hosts are not keen on installing qmail injectors and likes to make non RFC compliant email send. The fix is easy and there are no downsides to it, it would just be nice if it was correct by default.

    In functions.php in the includes folder change:
    Code:
       $sendmail_path = @ini_get('sendmail_path');
      	if ($sendmail_path === '')
      	{
      		// no sendmail, so we're using SMTP to send mail
      		$delimiter = "\r\n";
      	}
      	else
      	{
      		$delimiter = "\n";
      	}
    to:
    Code:
       	$sendmail_path = @ini_get('sendmail_path');
      	if ($sendmail_path === '')
      	{
      		// no sendmail, so we're using SMTP to send mail
      		$delimiter = "\r\n";
      	}
      	else
      	{
      		$delimiter = "\r\n";
      	}
    That is a quick and dirty fix, the if else is realy negated because the need to for \r\n all the time. A proper RFC compliant LF never hurt anything.

    The same needs to be done on diagnostics.php to enable RFC compliance.

  • #2
    Its done intentionally as we had what you have above but far too many problems were occuring with the mixture of Windows products, sendmail and qmail.

    Mike would probably best explain this, so I'll point him to this thread.
    Scott MacVicar

    My Blog | Twitter

    Comment


    • #3
      Yes I would like for that, this is on a windows machine, it would not send via localhost, or the qmail relay that it has. It would say it worked properly on windows and not send, but it via qmail it would give a link to http://cr.yp.to/docs/smtplf.html

      From that I knew that I needed to look for the mail functions and change the \n to \r\n, and now it works both with windows 2000 and qmail, not sure why it was not working with windows 2000 before as I thought it was BareLF ignorant, but none the less, it is working now.

      Also on that note, is there any other file I might need to edit for it to work that contain mail functions? I don't want any sneaky error popping up after I think it is all working.

      Comment


      • #4
        They all wrap into that mail function.

        http://www.vbulletin.com/forum/bugs....iew&bugid=2758 was the bug mike was dealing with.

        SMTP needs \r\n where sendmail automatically translates \n to \r\n so i'm not sure how we can detect qmail.
        Scott MacVicar

        My Blog | Twitter

        Comment


        • #5
          Thank you for this! I have been trying to figure out why my mail would not send via localhost for over a month.

          Comment


          • #6
            Are you guys using the qmail-inject or the sendmail wrapper?
            Scott MacVicar

            My Blog | Twitter

            Comment


            • #7
              no on the qmail inject, and as far as sendmail goes, qmail was not on the local machine so I can't point to it. If it was running qmail inject I could force the bare LF, but it would get removed anytime the control panel is upgraded, and that would be a pain for us, and the customers to have to manage each upgrade.

              This is from a windows machine to a qmail server in a Hsphere cluster, Hsphere uses qmail by default, however as I said, it had the same issue on windows virtual smtp server without the \r\n

              Comment


              • #8
                So what do you use then?

                http://bugs.php.net/bug.php?id=15841

                I've just read the PHP bug on it and various other help sites.

                SMTP lines \r\n all else should use \n since its not valid to send \r\n when executing a command on the system.
                Scott MacVicar

                My Blog | Twitter

                Comment


                • #9
                  HSphere uses a cluster. Create a php.ini with the details included here: http://us3.php.net/mail

                  you make a php.ini with the windows only config line for mail pointing to either localhost or to mail.domain.com (which is a qmail server, in hsphere cluster setup), initially both did not work. After making the edits I noted, they both worked, however I have it set to the qmail relay now as it is easier to track abuse from a central location.

                  [mail function]
                  ; For Win32 only.
                  SMTP = localhost
                  ;SMTP = mail.domain.com
                  smtp_port = 25

                  ; For Win32 only.
                  sendmail_from = [email protected]

                  So you just configure the mail functions in php.ini for windows, and note,that for most servers (that are not just totally open relays) you must have the sendmail_from configured to [email protected]

                  Comment


                  • #10
                    There was a reply there that might be fitting for this (on that php bug page you referenced, maybe the best thing would be to have a "windows" and "unix" if else as well:

                    The Right Thing(TM), then, is to determine which method (direct or SMTP
                    injection) is being done. If SMTP, use \r\n. If direct, determine what
                    the OS' line terminator is (\r\n for Windows, \n for Unix, \r for Mac
                    (?!)) and use that instead.

                    Comment


                    • #11
                      Scott,

                      All I tried was the Virtual SMTP server and when I couldn't get it to work I relocated the server to another network with a SMTP relay and all is working fine.

                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...
                      X