1

using the contactForm plugin, I want to make a contact form, that sends to an email address of the users choosing, not the email set up in the admin. Does anyone know the simplest way of doing this?

1
<input type="input" name="toEmail" value="">

https://github.com/craftcms/contact-form/tree/v1#dynamically-adding-email-recipients-requires-craft-25

  • Thanks, I saw this...but doesn't this get pulled from the server side? {{ 'me@example.com'|hash }} will this work if i just have a text input field then? – ToddPadwick Oct 20 '17 at 10:44
  • I also need to populate the from email with the same email otherwise the user has to fill it in twice. would this have to be done using js? – ToddPadwick Oct 20 '17 at 10:50
  • 1
    You have the <input id="fromEmail" type="email" name="fromEmail" value=""> field as well.. you can include javascript that equals them. For the twig part: this is rendered as soon as the user opens the page -> before the user makes any input. You just need to try if it needs a hash or if you have to include it manually in the plugins "sendMail" function – Robin Schambach Oct 20 '17 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.