We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27516
    • 13 Posts
    We have a website that was built back in August but not yet deployed (don’t ask). Anyways, somehow the email headers sent from forms have somehow changed:

    Old email--

    From: XYZ Loan Application [[email protected]]
    Sent: Friday, August 07, 2009 12:40PM
    Now--

    From: [email protected]
    Sent: Monday, January 04, 2010 10:33PM
    We definitely want the old format! The site is hosted at bluehost.com, running the following versions:

    MODx 0.9.6.3 (rev 4565)

    eForm 1.4.4.5

    PHP 5.2.11

    The eForm call looks like the following:

    [!eForm? &formid=`applicationForm` &tpl=`application form` &report=`application report` &vericode=`1` &subject=`Thank you [+name+] for contacting XYZ` &from=`[email protected]` &fromname=`XYZ Loan Application` &automessage=`application report auto`!]


    I tried setting the sendmail_from entry in php.ini (it was previously unset), with no change.

    I would greatly appreciate any suggestions as to where to look or what might have happened!

    --Steve

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You might want to try putting that eForm snippet call in a chunk and getting rid of the & that the rich text editor is adding to the document content. Other than that, unless Bluehost has done something with their mail servers to force all outgoing mail to have that from and fromname, I don’t see why it should be doing that.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 27516
        • 13 Posts
        Susan--

        Thanks for the reply. I poked around more, did some experiments, and determined that the problem was on the Bluehost side. They require that the ’from’ address be a valid email address on their mail system, whether or not email actually ends up there. By adding ’[email protected]’ as a mail account in cPanel (even though the MX records don’t point to their servers), it now works.

        Incidentally, the experiments primarily consisted of modifying eform.inc.php (substituting various ’From’ and ’FromName’ values) until it was obvious what emails were going through and how they were appearing.

        --Steve
          • 18913
          • 654 Posts
          Hi,
          I realize you have solved this. But I had run into the same situation and had a different solution. Rather than put in "no-reply" as you did (which I didn’t think of), my PHP call to the mail function would look like this
          $headers  = "From: $email\r\n";
          $headers .= "Reply-To: $email\r\n";
          $headers .= "X-Mailer: php\r\n";   
          
          mail('[email protected]','Test subject', 
          "From: $name 
          Comment: $comment
          Email: $email", 
          $headers);
          

          This part of a snippet processes a form for which a name, comment and email address have been entered, in this example, just sending those three items off in an email to "[email protected]". I found that if I did not have the first header ("From:") that I would get emails with the formatting you pointed out.

          FWIW,
          Matt