We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37744
    • 4 Posts
    Dear all,

    First of all, thank you very much for developing MODx Revo! What a great product this is! I already was very pleased with Evo, but I just switched to Revo and it really is amazingly easy to work with.

    I've created a Formit form on my 'test' server, and the redirect to the Thank you page works just fine.
    I installed Formit on another server, copied snippets and chunks, and referred to the correct ID to redirect to, but the redirect doesn't work. After submitting the page stays on that page, while I do get the confirmation and notification mail.

    In the error log I find the following message:
    [2011-12-13 12:09:46] (ERROR @ /index.php) An error occurred while trying to send the email:

    See:
    Test site: http://modx.duidelijkezaak.nl/bestellen.html
    Real site: http://www.visieinpraktijk.nu/bestellen.html

    Has anyone got any idea what the problem is?
    Please help!

    Thank you very much in advance,
    Eline [ed. note: eline_modx last edited this post 14 years, 10 months ago.]
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      Hello,

      Could you tell us more about the server configurations and how you are sending mail. Also if you create a new user and have MODX email the password, do you get a message in the error log?
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 37744
        • 4 Posts
        Hi AMDbuilder,

        Thank you very much for replying!

        System info:
        PHP Mailer: 2.0.4
        MySQL: 5.0.77
        PHP: 5.3.6

        Do you need other server configuration details?

        My form has been based on the emailUser snippet. See http://modxrules.com/articles/send-a-confirmation-email-with-formit

        Form:
        <p>[[!FormIt? &hooks=`spam,email,emailUser,redirect` &emailTo=`[email protected]` &emailSubject=`Bestelling bij visieinpraktijk.nu` &emailFromName=`[[+name]]` &emailTpl=`ContactTpl` &redirectTo=`7` &store=`1` ]]</p>
        <div class="error">[[+fi.error.error_message]]</div>
        <form class="form" action="[[~[[*id]]]]" method="post"><input type="hidden" name="nospam:blank" value="" />
        <h3>bestelformulier</h3>
        <p>Ja, ik wil graag het boek Werkgeversstrategie bestellen.</p>
        <div class="textfield"><label for="name">Naam: </label> <span class="error">[[+fi.error.name]]</span><input id="name" style="width: 100%;" type="text" name="name:required" value="[[+fi.name]]" /></div>
        <div class="textfield"><label for="company">Bedrijf: </label> <input id="company" style="width: 100%;" type="text" name="company" value="[[+fi.company]]" /></div>
        <div class="textfield"><label for="address">Adres: </label> <span class="error">[[+fi.error.address]]</span><input id="address" style="width: 100%;" type="text" name="address:required" value="[[+fi.address]]" /></div>
        <div class="textfield"><label for="zipcode">Postcode: </label> <span class="error">[[+fi.error.zipcode]]</span><input id="zipcode" style="width: 100%;" type="text" name="zipcode:required" value="[[+fi.zipcode]]" /></div>
        <div class="textfield"><label for="city">Plaats: </label> <span class="error">[[+fi.error.city]]</span><input id="city" style="width: 100%;" type="text" name="city:required" value="[[+fi.city]]" /></div>
        <div class="textfield"><label for="phone">Telefoon: </label> <span class="error">[[+fi.error.phone]]</span><input id="phone" style="width: 100%;" type="text" name="phone:required" value="[[+fi.phone]]" /></div>
        <div class="textfield"><label for="email">E-mail: </label> <span class="error">[[+fi.error.email]]</span><input id="email" style="width: 100%;" type="text" name="email:email:required" value="[[+fi.email]]" /></div>
        <div class="textfield"><label for="message">Ruimte voor opmerkingen: </label>
        <textarea id="message" style="width: 100%;" name="message" rows="2">[[+fi.message]]</textarea></div>
        <div id=""><input type="submit" name="Submit" value="Bestelling versturen" /></div>
        </form>

        emailUser snippet:

        <?php
        //configuration
        $mailFrom = $modx->getOption('emailsender'); //OR USE YOUR OWN;
        $mailFromName = $modx->getOption('site_name'); //OR USE YOUR OWN;
        $mailSender = $modx->getOption('site_name'); //OR USE YOUR OWN;
        $mailSubject = 'Uw bestelling bij visieinpraktijk.nu';
        $mailReplyTo = $mailFrom;

        //get fields values so they can be replaced in the email chunk
        $confirmationFields['name'] = $scriptProperties['fields']['name'];
        $confirmationFields['company'] = $scriptProperties['fields']['company'];
        $confirmationFields['address'] = $scriptProperties['fields']['address'];
        $confirmationFields['zipcode'] = $scriptProperties['fields']['zipcode'];
        $confirmationFields['city'] = $scriptProperties['fields']['city'];
        $confirmationFields['phone'] = $scriptProperties['fields']['phone'];
        $confirmationFields['email'] = $scriptProperties['fields']['email'];
        $confirmationFields['message'] = $scriptProperties['fields']['message'];

        //get user's email
        $mailTo= $scriptProperties['fields']['email'];

        $message = $modx->getChunk('ConfirmationTpl', $confirmationFields);

        $modx->getService('mail', 'mail.modPHPMailer');
        $modx->mail->set(modMail::MAIL_BODY,$message);
        $modx->mail->set(modMail::MAIL_FROM,$mailFrom);
        $modx->mail->set(modMail::MAIL_FROM_NAME,$mailFromName);
        $modx->mail->set(modMail::MAIL_SENDER,$mailSender);
        $modx->mail->set(modMail::MAIL_SUBJECT,$mailSubject);
        $modx->mail->address('to',$mailTo);
        $modx->mail->address('reply-to',$mailReplyTo);
        $modx->mail->setHTML(true);

        if (!$modx->mail->send()) {
        $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err);
        return false;
        }

        $modx->mail->reset();

        return true;

        I also created two chunks, ConfirmationTpl and ContactTpl, but like I said in my previous post, the e-mails work just fine. Only the redirect to the Thank you page doesn't work.

        If I create a new user, I don't get a message in the error log.

        Hope you can help me out.
        Thanks again!
          • 37744
          • 4 Posts
          Hello again,

          For your information, today I copied the form from the real (problem) site to a third site. No problems there... the redirect works perfectly there...

          So could it be something to do with the server settings?
            • 1343 ☆ A M B ☆
            • 2,213 Posts
            Hello,

            It appears I forgot to subscribe to the thread. I would agree, it sounds like there is a server setting interfering with the redirect. Could you share both server configurations so we can figure out what's different?
              Patrick | Server Wrangler
              About Me: Website | Tweets |  MODX Hosting