We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20557
    • 43 Posts
    I mentioned in another thread that I had to add the following lines to eform.inc.php to get a contact form to work:

    ini_set ("SMTP","localhost");
    ini_set ("sendmail_from","[email protected]");
    


    One of the admins at most hosting provider said that this was because
    You’re missing out a variable which states who the email is from (it’s an RFC 2822 requirement)

    I want to set it up so that the person who receives the e-mail via the contact form can simply press reply to send a message to the sender. So I tried adding &from=`[+email+]` to the eform call. However it does not work, emails are always shown as coming from "[email protected]".

    How can I correct this?

    Thanks and regards,
    Matt
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Try it with just the fieldname:
      &from=`email`
        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
        • 20557
        • 43 Posts
        Hi Susan,

        No luck with "&from=`email`" the message was flagged as coming from [email protected].

        Also, if I remove the line:

        ini_set ("sendmail_from","[email protected]");


        From the eform.inc.php file, then messages come from "Unknown Sender".

        Thanks,
        Matt
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ok, I’ve done some work with it, and &from=`[+email+]` &fromname=`[+name+]` work for me; these are the name attributes of the form fields used. If you go to my site and contact me, you’ll see the debug info it’s producing. http://www.sottwell.com/contact.html
          [!eForm? &formid=`ContactForm` &tpl=`ContactForm` &report=`ContactReport` &subject=`sottwell.com Contact` &thankyou=`ThankYou` &from=`[+email+]` &fromname=`[+name+]` &replyto=`email` &debug=`1` &eformOnBeforeMailSent=`getServer` &eformOnValidate=`checkField`!]
            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
            • 20557
            • 43 Posts
            Still no luck for me. If I set
            &from=`[+email+]` &fromname=`[+name+]`

            I get "[email protected]" as both the email and fromname in the message that arrives. If I remove
            ini_set ("sendmail_from","[email protected]");
            I get "Unknown Sender".

            Does this mean it is a config issue with the server?

            Thanks,
            Matt
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Are you sure that those are the name attributes of the form fields in question?
              <input name="email" .../>
              <input name="name" ... />
                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
                • 20557
                • 43 Posts
                Ah ha! Setting &replyto=`email` has done the trick! I noticed it in your example...

                The message still comes from [email protected], but when you hit reply it uses the message senders address.

                That is all I needed it to do.

                Incidentally, both of those input fields are set as you mentioned:
                <input name="email" .../>
                <input name="name" ... />

                Thanks for your help.
                Matt
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  My fault entirely. I completely missed the part about this being about replying to the email! I thought that the email from the form wasn’t getting sent.
                    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