We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18878
    • 210 Posts
    Hello smiley

    I’m using a Windows Server as a testing environment and I was just testing the "Contact us" form that uses eForm and comes with the default installation. The code is this:

    [!eForm? &formid=`ContactForm` &subject=`[+subject+]` &to=`[(email_sender)]` &ccsender=`1` &tpl=`ContactForm` &report=`ContactFormReport` &invalidClass=`invalidValue` &requiredClass=`requiredValue` &cssStyle=`ContactStyles` &gotoid=`46` !]

    The form seems to work fine, it redirects to the "Thank you" page, BUT the mail never arrives. So I changed the &to parameter to this: &to=`[email protected]` and now I get the following error after submitting the form:

    PHP error debug
    Error: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address
    Error type/ Nr.: Warning - 2
    File: F:\McWebSites\metrotec\manager\includes\controls\class.phpmailer.php
    Line: 438
    Line 438 source: $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);


    It’s very strange, because I know the PHP mail() function is working correctly. I verified it by using the Forgot Password option; the new password activation message always arrives instantly.

    I believe this a headers format problem on windows. The Forgot Password option uses the WebLogin snippet and the file weblogin.common.inc.php. Inside this file, the code that sends email works fine (look at the headers format):

    if(!mail($email, $emailsubject, $message, "From: ".$emailsender."\r\n"."X-Mailer: Content Manager - PHP/".phpversion())) {
    return webLoginAlert("Error while sending mail to $mailto",1);
    }


    With eForm, the code that sends email is located on file class.phpmailer.php and it looks like this:

    $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);

    It’s just a guess, but I think this header has a format that the mail() function is rejecting.

    Any suggestions / ideas will be greatly appreciated.

    Mc
      • 6333
      • 13 Posts
      Hey Mc:

      We’ve suddenly started having this problem too. Have you found a solution to it? What version eForm are you running?

      We have eForm 1.4.4 here.
      See Ya!
      ~Brant
        • 6333
        • 13 Posts
        I’ve done some poking around a little and haven’t been able to find much. I think McClausky might be on the right track. I will try the code he has listed & see what happens...

        IMT, here is the current eForm call for us...

        [[eForm? &formid=`CampusMessage` &from=`[email protected]` &fromname=`Campus Messaging` &to=`[email protected]` &subject=`[+subject+]` &tpl=`campus_message_form` &report=`campus_message_email` &hiddento=`to` ]]
          • 18878
          • 210 Posts
          I’m using eForm version 1.4.4 too.

          Well, I think it definitely has something to do with the mail function format.

          I created a little phpMailTest.php page to test the mail() function. Something like this:

          <?php

          // The message
          $message = "What’s up";

          // Send
          mail(’[email protected]’, ’test PHP Mail function’, $message, "From: [email protected]\r\n");
          ?>


          The above code works just fine, so I know that my windows server can send emails via PHP code.

          Now, try chaging the receiver just a little bit:

          mail(’john <[email protected]>’, ’test PHP Mail function’, $message, "From: [email protected]\r\n");

          ...and it won’t work (the mail never arrives).

          It’ll be good to know if this can be fixed with a new eForm version or some code modification at class.phpmailer.php.

          Mc
            • 6333
            • 13 Posts
            Did you try to set it up like it is in the WebLogin file?

            We tried that here, I think it may have worked. I can’t really tell -- our email server is beginning to act up! >:(

            One other thing that may help, is to edit the PHP.ini file and set up the SMTP settings to point to your SMTP server’s IP address. Even if it’s the local host. When I did that, we didn’t need to modify the phpmailer file at all.

            [I’ve got ModX running semi-smoothly on IIS 6.0... undecided ... this is the last issue we’ll have with it, AFAIK.]

            Let me know what happens!

            We run Linux + Postfix for our email server here.
            See Ya!
            ~Brant
              • 18878
              • 210 Posts

              Quote from: dafyre at Oct 10, 2007, 10:19 PM
              One other thing that may help, is to edit the PHP.ini file and set up the SMTP settings to point to your SMTP server’s IP address. Even if it’s the local host. When I did that, we didn’t need to modify the phpmailer file at all.

              Branrt: I tried setting SMTP to the server’s IP address...didn’t work.

              Quote from: dafyre at Oct 10, 2007, 10:19 PM

              Did you try to set it up like it is in the WebLogin file?

              We tried that here, I think it may have worked. I can’t really tell -- our email server is beginning to act up! >:(

              How did you implement this, did you change any files?

              huh

              Mc
                • 6333
                • 13 Posts
                Well, we had some other problems with our Server and FPSE... so we’re reverting back to 2003 Standard (not R2).

                I’ll tinker some more and we’ll see what happens after I get my servers back up!

                The file I edited was class.phpmailer.php or something like that. I’ll find it again & post.

                See Ya!
                ~Brant.
                  • 18878
                  • 210 Posts
                  Quote from: dafyre at Oct 11, 2007, 08:57 PM

                  Well, we had some other problems with our Server and FPSE... so we’re reverting back to 2003 Standard (not R2).

                  I’ll tinker some more and we’ll see what happens after I get my servers back up!

                  The file I edited was class.phpmailer.php or something like that. I’ll find it again & post.

                  See Ya!
                  ~Brant.

                  Well, after I migrated the site to a linux server at my host company, the mail problem dissapeared. It’ll be interesting to know how to fix it in windows though.

                  Mc
                    • 30884
                    • 142 Posts
                    I’d love to see how you managed to resolve it on an internal Windows smtp server. I’m propagating to a Unix server shortly but to have 2 lines which I can always rem one out to test internally with would be great. Any chance of showing us the revised order of the$rt @mail line?

                    Cheers

                    TxRx
                      p i x e l p u s h e r e x t r o d i n a i r e
                      A x i s A n i m a t i o n . c o m
                      • 30884
                      • 142 Posts
                      Anyone?
                        p i x e l p u s h e r e x t r o d i n a i r e
                        A x i s A n i m a t i o n . c o m