We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6723
    • 93 Posts
    I have a site I’ve been developing in modx-1.0.2 on a dedicated server - everything seems fine except for the EForm and a web contact form. The Eform and form work perfectly when i put in an external email address for testing, but when I put in the correct email address into the snippet call, the mail server box is rejecting it. I’ve tried using different email accounts on the domain, with similar results - no messages. I’ve also checked the account works and it’s not getting picked up by any spam softwatre / folders etc.

    This is the snippet

    [!eForm? &formid=`ContactForm` &subject=`Pulse Regeneration web form submission` &to=`[email protected]` &ccsender=`1` &tpl=`ContactForm2` &report=`ContactFormReport`&gotoid=`82` !]


    If I replace [email protected] with anyother email it works fine. I’ve contacted the ISP that look after the email server box and they’ve suggested making changes to way the PHP sends the email, but I can’t really understand what it is doing, or how to go about making the changes within the EForm snippet or it’s inc file. Below is what they suggest;

    What needs to be included is;

    1. A variable that tells the script where the email is being sent from; For example; $SendEmail ="[email protected]";
    2. Adding this variable onto the end of the mail() function. Below is a very basic php script, I have included the extra entries in italic.

    $nameField = $_POST[’name’];
    $emailField = $_POST[’email’];
    $SendEmail ="[email protected]";
    $body = <<< EOD

    Name: $nameField
    Email: $emailField
    EOD;

    $headers = "From: $emailField\r\n";
    $headers .= "Content-type: text/html\r\n";
    $sucess = mail($webMaster, $emailSubject, $headers, $body, ’-f’.$SendEmail);

    The important part here is the ’-f’.$SendEmail at the end of the mail() function. The ’-f’ although not a php command is a sendmail parameter that is telling our mailserver the mail is being sent from the $SendEmail address and nowhere else.


      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Add parameters to the eForm call for &from=`[+field-for-sender’s-email+]` and &fromname=`[+field-for-sender’s-name+]. You can also add a &replyto=`[+field-for-sender’s-name+] if you want to.

      These will have the added advantage of letting you just hit "reply" to the email and getting the sender’s address and name already in the "to" field of your mail client.
        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
        • 36875
        • 5 Posts
        I had the same problem as David (mail via one ISP, site via another), tried everything mentioned above, didn’t work. The server somehow "ate up" the e-mails that were sent to addresses in our own domain.

        Finally I discovered that the control panel my ISP uses had an option like "Use local mail server to handle my emails". It may be called something else in other control panels but you get the idea. After I unchecked this option, it worked.
          • 7455
          • 2,204 Posts
          is the site running on pulseregeneration.co.uk ?

          if so then let the host disable mailserver for that domain that should work,
          php sends the mail to the server smtp that smtp server sees tha the domain is on the same server and tries to deliver the mail internaly without looking at the dns first.
          if the mailserver is disabled on the host where the site is hosted the the smtp will look to the dns and see that the mailbox is external and your mail wil be deliverd to that server.

          Dimmy
            follow me on twitter: @dimmy01
            • 22673
            • 72 Posts
            I am having this problem too. We have narrowed the issue down to the email account provider having a really strict mail policy. The "Return-Path" header is checked to see if it’s a legitimate email, but it is not being set as the form user’s email address and is defaulting to one which doesn’t exist ([HOSTING-ACCOUNT-USERNAME]@domain.co.uk). So the email account provider is rejecting it with no errors.

            We have tried modifying the eForm snippet and also the PHPMailer file without success.
              • 21671
              • 244 Posts
              I have a couple of clients whose email is hosted by perimeter and their site is hosted with Hostgator. My problem was that the user passwords were not being sent from the MODx security tab when I clicked on a user and then chose new password and then send password by email. I went into the Cpanel for the site, and then chose email configuration, and then went into the SPF settings and added the domainname for my client to the current server name. The problem was that in a shared hosting environment there was a mismatch between the name of the shared host gti.websitewelcome.com and clientname.com and thus the email was not being sent.

              I added cleintname.com to the list of included domains and then the emails from MODx worked.

              I hope this helps someone.

              -Noah