We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21969
    • 4 Posts
    I’ve been troubleshooting this for a while. Took my form back down to the very basics (i.e. example form) and still no luck getting it to send me an email. It submits with no errors and goes to my thank you page, but i never receive an email.

    The call:
    [!eForm? &formid=`contactform` &subject=`[+subject+]` &to=`[email protected]` &tpl=`ContactForm` &report=`ContactFormReport` &gotoid=`64` !]


    The tpl:
    <p class="error">[+validationmessage+]</p>
     
    <form id="contactform" method="post" action="[~[*id*]~]" name="contactform">
     
    	<fieldset>
    		<h3> Contact Us</h3>
      
    		<label for="name">Your name:</label>
    		<input name="name" id="name" class="text" type="text" eform="Your Name::1" /><br /> 
     
    		<label for="email">Your Email Address:</label>
    		<input name="email" id="email" class="text" type="text" eform="Email:email:1" /><br /> 
     
    		<label for="subject">Subject:</label>
    		<input name="subject" id="subject" class="text" type="text" eform="Subject::1" /><br /> 
     
    		<label for="message">Message:</label>
    		<textarea name="message" id="message" eform="Message:textarea:1"></textarea><br />
    		
     
    		<input type="submit" name="contact" id="contact" class="button" value="Submit" /></p>
     
    	</fieldset>
     
    </form>



    Report:
    <p>This is a response sent by <b>[+name+]</b> using the feedback form on this website. The details of the message follow below:</p>
     
    <p>Name: [+name+]</p>
    <p>Email: [+email+]</p>
    <p>Regarding: [+subject+]</p>
    <p>Comments:<br />[+message+]</p>
     
    <p>You can use this link to reply: <a href="mailto:[+email+]?subject=RE: [+subject+]">[+email+]</a></p>


    any help is greatly appreciated.
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      You can test to see if your server sends mail by using a simple PHP script. Paste the following into a text file (change the email address) and save it as "mail_test.php":
      <?php
          mail('[email protected]', 'Subject: Testing PHP Mail Function', 'Does this work?');
      ?>
      


      Upload that to your webserver, to the root of your site. You can either run it on the command line (if you have shell access, you’d type "php mail_test.php", or you can navigate to it in a browser, e.g. "www.yourdomain.com/mail_test.php" -- that should trigger it to execute. Now check your email. Did you receive a note (sometimes it takes a while)? If not, you may have to check your email settings, but on most hosts, this works normally. If that’s not working, there’s no way eForm will work...
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Actually if the host doesn’t allow the mail() function to send to external mail addresses, you can make a couple of changes to the mailing functions in the eForm code to have eForm use SMTP instead. There are three or four places in the eform.inc.php file where it mails stuff, and the line
        $mail->IsMail();

        needs to be changed.

        eForm uses the phpmailer class that’s in the manager/includes/controls folder, so looking at the documentation on the phpmailer site shows how to set up SMTP configuration when using the class.
          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
          • 10567
          • 6 Posts
          I just tested this using Everett’s script and the server sent the email just fine - eForm still won’t send the email though. The form action is set to the same id as the form page and it simply refreshes the page -- I have a &thanks tpl/chunk set in the call and it ignores that. Any other debug/testing options?
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Do you have the eForm snippet called uncached [! ... !]
              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
              • 10567
              • 6 Posts
              Got it sorted... Was having a problem with syntax on a multiple checkbox validation item... THANKS!