Form to Email Plugin

formToEmail Plugin allows you to add forms to your pages.

The content of the form will be sent via email to any email address (or addresses) you specify.

Sample usage

You would add something similar to this to one of your pages (make sure there are no spaces between the brackets:

[formToEmail ]

[subject=Message from {1}] [to=[email protected]][from={2}]

[Your Name:|text|required]

[Your Email:|text|required]

[Your Message:|textarea|required]

[/formToEmail]

Fields are specified by [LABEL|INPUT TYPE|REQUIRED FLAG]

Only LABEL and INPUT TYPE are necessary to add a field to the form. INPUT TYPE can be: text or textarea.

Additional data

To specify where to send the email, use:

[to=YOUR ADDRESS HERE] You can specify several addresses separated by commas

To specify what address to use as the sender, use:

[from=EMAIL ADDRESS]

To add a custom subject use:

[subject=YOUR SUBJECT]

To customize your "Thank you" message (message that appears after the user has successfully submitted the form) use:

[thankYouMessage=YOUR MESSAGE] (do not use html in this message)

Numbers in brackets {} will be replaced by data supplied by user when the form is submitted. In this way, you can use an email address as the "from" attribute of the email or use the name entered as part of the subject for example. Numbers indicate field order. In the above example, "Your Name:" is number 1, and "Your email:" is number 2.

Formatting

Between the form fields, you can add html markup. You can also add html markup inside the brackets if, for example, you wanted to make the labels bold, or to add a break between the label and the form field.

Note: This plugin only handles one form per page.

17 Comments

  1. Kevin L.
    Laura,
    I can get the plugin to show the form and it seems to function correctly but I never receive an email when the form is used. Is there something special about the [to=email] part of the code that I might need to know?
    Thanks
  2. Laura
    Kevin,
    Are you able to receive email in other places, like when someone writes a comment? I would check the undeliverable folder in CF and the mail logs in the CF administrator to see what the problem might be.
  3. Andrea
    Hi Laura,
    I am trying the plugin.
    Form is this:

    [formToEmail]

    [thankYouMessage='Thanks for your message. I will reply as soon as possible.']

    [subject=Message from {1}] [to=andrea@andreacfm[email protected]][from={2}]

    [Your Name:|text|required]

    [Your Email:|text|required]

    [Your Message:|textarea|required]

    [/formToEmail]

    I am getting this error:
    An error occurred while trying to encrypt or decrypt your input string: Given final block not properly padded.
    at cfHandler2ecfc2120875415$funcPROCESSEVENT.runFunction(D:\inetpub\vhosts\andreacfm.com\httpdocs\components\plugins\user\formToEmail\Handler.cfc:194)
  4. kelly
    why does this not work on a post ?
  5. Laura
    Kelly,
    The plugin is only set up to show the form in pages, not posts.
  6. JC
    How about radio buttons? Being able to give them a yes/no or something would be nice.
  7. salvatore
    salvatore
    Hi Laura,
    how can i change the text after the captcha image, ie transale it in other lang?
    regards
  8. Laura
    salvatore,
    The captcha image is placed by the captcha plugin. Unfortunately, it doesn't have the ability to change languages from the admin, but you can change the plugin code.

    I'd actually recommend to disable the captcha and use the cfformprotect plugin: http://www.mangoblog.org/news/goodbye-captcha-hello-cfformprotect
  9. Mike Henke
    This is awesome. Worked like a champ. Thanks
  10. stacy
    Hi Laura,
    My host requires me to use my login and password
    to send mail to help prevent spam.
    Is there a way to pass this info.
  11. Laura
    stacy,
    This plugin uses the global email settings set in the config.cfm file. If your server requires authentication, then you need to fill in the information in that file, inside the "mailServer" node there are keys for "server" "username" and "password".
  12. mike leger
    love it, thanks. would love to see radial buttons or drop down
  13. Qasim Rasheed
    Qasim Rasheed
    I am getting the same error as Andrea mentioned. Any idea?


    An error occurred while trying to encrypt or decrypt your input string: Given final block not properly padded.
    at cfHandler2ecfc2120875415$funcPROCESSEVENT.runFunction(D:\inetpub\vhosts\andreacfm.com\httpdocs\components\plugins\user\formToEmail\Handler.cfc:194)

    [/formToEmail]

    I am getting this error:
    An error occurred while trying to encrypt or decrypt your input string: Given final block not properly padded.
    at cfHandler2ecfc2120875415$funcPROCESSEVENT.runFunction(D:\inetpub\vhosts\andreacfm.com\httpdocs\components\plugins\user\formToEmail\Handler.cfc:194)
  14. Laura
    Qasim,
    Please ask the question in the forums. Do you get that issue every time you use it?
  15. Tom Mitchell
    I do not think Railo keeps the form fields in order in the email for reference {1}.
  16. Brad
    Thank again, this worked like a charm!
  17. Guilherme
    Guilherme
    I can`t get it to work.
    I activeted the plugin that ships with Mango, created a new page and pasted the formToEmail sample code into the TinyMce editor and save it. The only thing I get is the same code posted between <p></p>.

    Am I missing something?

Leave a Reply