Fast and Easy Email Form PDF Print E-mail
Written by db   
Wednesday, 10 February 2010 12:32

Overview

NOTE:
A new website at joomla.unlikelysource.org is online!

The unlikelysource.net website was hacked is permanently down. 

IF YOUR EMAILS ARE NOT BEING SENT ... update to version 1.8.1 immediately!!!

see: joomla.unlikelysource.org/index.php/simple-email-form-bugs-menu/17-emails-not-being-sent

INTRO:

This is a Joomla module which implements a simple email form. 
To install, login as the Joomla administrator, and select "Extensions" - "Install/Uninstall". 
Browse for the downloaded ZIP file and click "Upload File and Install". 

After installation, typical usage would be to configure it to load inside a Joomla article

(as is the case here). 
The way to do this is as follows:

  1. Go to "Extensions" - "Module Manager" and select the module.
  2. In the "Details" box, modify "Position" to "user99" (or anything, really)
    NOTE: you'll have to type this in manually -- it's not on the list.
    details_275.png
  3. In your target article, add this line: "{loadposition user99}"
    NOTE: don't put a space between "{" and"loadposition" and also don't put
    a space between"user99" and "}"! 
  4.  If it still doesn't load, go to "Extensions" - "Plugin Manager" and make sure that the
    "Content - Load Module" plugin is enabled.
     

Quick Start

 Features

  • Supports Joomla 2.5 and 3.0!
  • Eight configurable fields: you configure the labels and sizes
  • "From" and "Subject" fields appear automatically
  • "From" field is checked to make sure it's a valid email address (using regex, not a realtime check)
  • "Reply-To" header can be activated
  • Fields 1 - 8 can be set to "Active," "Required," "Hidden", or "Inactive" in the module configuration, as needed
  • Hidden fields will automatically appear in the email
  • Body of email message contains labels + user input data for active and hidden fields
  • Any of the 8 fields can be normal (text), textarea, radio buttons, checkboxes or dropdown (select)
  • You can configure a recipient of the submitted email form plus optional CC and/or BCC
  • Optional "Send Copy to Me" field or automatic user copy
  • You can set the space between the labels and the input fields
  • You can specify an optional redirect URL if the form is submitted successfully
  • Info in form fields can be either reset or retained after form submission
  • Includes a field to upload an email file attachment
  • Email attachments can be filtered by filename extension
  • Max length of each field can be set (thanks to Rui Castro Lobo!)
  • NEW!!! 25 language files are included: Arabic, Bulgarian, Chinese, Czech, Danish, Dutch, English, Estonian,
    Finnish, French, German, Greek, Hebrew, Hungarian, Italian, Latvian, Polish,
    Portugese (Brazilian), Russian, Slovak, Spanish, Swedish, Thai, Turkish, Vietnamese
  • You can activate "Test Mode" to help you troubleshoot when installing
  • An optional "Captcha" can be activated
    • Uses PEAR library Text_CAPTCHA (included)
    • Requires that the GD extension be compiled with your PHP installation
    • Uses open source FreeSansBold.ttf font (included)
    • You can configure the height, width, and number of characters
    • Colors of the text, lines, and background can be configured
    • CAPTCHA files older than 5 minutes are deleted
    • CAPTCHA can be either an image or text
    All configuration is done by module manager: no complicated components to install!

Download Module

http://opensource.unlikelysource.com/mod_simpleemailform_1.8.1.zip (NEW!!! latest stable version)

IMPORTANT NOTE!!!  Version 1.8.1 ONLY works on Joomla 2.5+ and Joomla 3.0!!!  Version 1.8.0-1x works on Joomla 1.5.x
(Includes 25 languages: Russian, Brazilian Portugese, Bulgarian, Dutch, English, Estonian, Finnish, French, German, Greek, Italian, Latvian, Polish, Spanish, Danish, Hebrew, Hungarian, Swedish, Thai, Turkish and Vietnamese.)

(Thanks to: Lars Dahlberg, Mats Arvendal, Lauri Liikane, Muneca Osorio, Jean-Michel Delor, Nasos Liagos, Cristian Lorenzini,
Uwe Stockinger, Michał Przekopowski, Ernesto, Polgar Istvan, Alex Breems, Alexandre Lahoz Fernandez,
Dror Lamdan, Noona Khongpanit, Nurettin Acar, YangMei, Rudolf Boogerman, Karol Kostia, Iiteam, Sami Koivisto and saosangmo!!!)

http://opensource.unlikelysource.com/mod_simpleemailform_1.8.0A-1x.zip (New version for Joomla 1.x users)

http://opensource.unlikelysource.com/mod_simpleemailform_1.8.0A.zip (previous version)

 

Demo

From 
Subject 
Name 
Comments 
Please enter the following 
 Help us prevent SPAM!
  Send me a copy
    

 

Tips

  • If you plan to use CAPTCHAs (to prevent SPAMmers) you need to disable cache for the module.  Please note that if you are using Joomla cache, and plan to place the module inside an article, you need to disable cache for that article!!!  You *cannot* use cache and also use CAPTCHAs.  The CAPTCHA image will get cached, and you'll never get the right value!
  • For dropdown (select), radio button, or checkbox fields, you can populate them by supplying default values in this format:
    A=Apple,B=Banana,C=Cantelope,etc.
    In this case, the customer will see Apple, Banana and Cantelope on screen.  If "Apple" is chosen, "A" is returned, etc.
    For textareas, you need to specify, in the size field, a value in this format: rows,cols
    So if you enter 4,40 you will get a textarea of 4 rows X 40 columns, etc.
  • Email checking is pretty loose at the moment; debating whether or not to strengthen it (comments?)
  • You MUST create the directory where file attachments are stored, and make sure Joomla has rights to write files into this directory.  (You could use the Media Manager to do this -- see the next tip.)
  • You MUST indicate the absolute path to this directory in the configuration.  If you are unsure of the exact path, login as a Joomla admin, and go to the Site - Media Manager menu.  Under Files you will see the absolute path to where your images are stored.  (You could even create an "uploads" folder here, and use the path specified when configuring the Directory to save attachments parameter.)
  • Requires PHP 5 to work!
  • Make sure that the Joomla Content - Load Module plugin is enabled
  • Make sure simple email form module is assigned to the same menu as the the article which contains the module
  • If you plan to use the CAPTCHA:
    • You MUST create a directory where the CAPTCHA will be written
    • If you are unsure of the exact path, login as a Joomla admin, and go to the Site - Media Manager menu.  Under Files you will see the absolute path to where your images are stored.  (You could even create a "captcha" folder here, and use the path specified when configuring the Directory to write captchas parameter.)
    • Joomla needs read and write rights to this directory
    • The directory must be publicly accessible via a URL
      I.e.  the CAPTCHA directory is /var/www/yoursite.com/images/captcha
      the URL would be http://yoursite.com/images/captcha
    • Creates CAPTCHA files with prefix "captcha_" and erases old images
    • Do not set the CAPTCHA word length to greater than 8
    • PLEASE don't email me until you've read the documentation on how to make a Joomla module appear inside an article!!!

Here are some references to help you:

http://docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F

http://www.joomlabamboo.com/blog/tutorials/using-the-loadposition-plugin-in-joomla

How to put 2 forms into one article

 

NOTE: requires version 1.7.08 or later!!!

 

To put two forms on the same page you''ll need to add a new Simple Email Form Module (again) but give it a new name.

Here is an example of adding a 2nd Simple Email Form Module inside an article:

  1. Login as Joomla Administrator.
  2. Install the module as per the installation directions.
  3. Go to module manager



     
  4. When you go to give the module a title and position.
     
  5. Don''t forget to make sure the module has permission to appear on all pages (or whatever pages are appropriate).

     
  6. After entering your Basic Options, choose Advanced Options and set the Form Instance to 1.

     
  7. Save and Close when done configuring options.
  8. You're done with the 1st form.
     
  9. For the 2nd form, from the Module Manager menu choose New.

  10. In the "Select a Module Type" dialog, choose another instance of Simple Email Form.

     
  11. Make sure you enter a *different* Title and a *different* Position!!!

     
  12. After entering your Basic Options, choose Advanced Options and set the Form Instance to 2.

     
  13. Save and close.

     
  14. In the article, be sure to specify the two different load positions.

 

Resulting Page

 

To Do / User Suggestions

  • Have the name in the "From" field be the customer's name
  • Ability to control the  size of the File Upload field
  • Ability to populate the text area with a pre-formatted message
  • Support for a template to provide pre-formatted HTML emails
  • The subject field should appear directly over the text area message box. When I enable extra fields they appear below the subject, but above the text area
    (thanks to Richard for the last 2 suggestions)
     

 

 

Please help support our programming efforts!

 

How to Change the CAPTCHA Background Color

 

1. Login as Joomla admin
2. Select "Extensions - Module Manager"
3. Locate "Simple Email Form" and click on it
4. In the section to the right labeled "Module Parameters" locate "Captcha Background Color"
5. Enter an appropriate HTML color code

 

Troubleshooting

If emails are not getting sent:

Verfiy that your email addresses are correct

UPGRADE to version 1.7.05+

Activate "Test Mode" and confirm there are no mail server errors
 

If you see this error message:

"Invalid address: Invalid address: Invalid address:"

Solution: UPGRADE to version 1.7.04+

 

If you see this error message:

 

Warning: Missing argument 4 for sendResults(), called in <some/directory/path> on line 476 and defined in \path\to\joomla\modules\mod_simpleemailform\mod_simpleemailform.php on line 214

Solution: UPGRADE to version 1.1.12

 

If you see this error message:

Error: Unable to cleanup old captchas

Warning: file_put_contents(/company/homepages/9/xyz/htdocs/images/captcha/captcha_12345.png) [function.file-put-contents]: failed to open stream: No such file or directory in /company/homepages/9/xyz/htdocs/FurtherIndications/modules/mod_simpleemailform/mod_simpleemailform.php on line 347

Most likely it is because:

(A) You have not configured a directory in which the program can write the CAPTCHA images, or
(B) You have misspelled the directory name, or
(C) You do not have the permissions set properly so that Joomla can write to this directory

 

Try the following:

  1. Look carefully at the directory path which is displayed in the error message. Notice, in the example above, "/company/homepages/9/xyz/htdocs/images/captcha/captcha_12345.png" is the file which could not be written.
  2. Login as the Joomla Adminstrator
  3. Select Extensions - Module Manager
  4. Locate and click on the link for the Simple Email Form module
  5. Look for "Directory to Write Captchas"
  6. Make sure that the directory path matches the one you see in the error message
    (In this example, it would be "/company/homepages/9/xyz/htdocs/images/captcha")

If the module doesn't appear

(Thanks to Chad for this tip)

(A) Make sure the module is enabled (that one has caught me LOTS of time and I wrote the dang module!).
(B) In the module manager, make sure that "Menu Assignments" is set to ALL (or whatever menu the article appears under).
(C) Go into the article which contains the module and make sure you correctly spelled {loadposition user99}
(or whatever user position you chose to use -- doesn't have to be "user99", it could be "emailform" or any other unique word -- BUT ... see note below).
(D) Make sure that whatever user position you chose matches the user position you specified in the module manager
(E) Go to "Extensions" - "Plugin Manager" and make sure that the "Content - Load Module" plugin is enabled.

 

(Thanks to Lars for this strange quirk)

If you go through all the suggestions above, and the module STILL does not appear, try changing the to something which starts with "user". Some templates are very particular about this. So, for example, if you used {loadposition emailform} change it to {loadposition user99}. Also, make sure that you go to Extensions - Module Manager - Simple Email Form, and change the position to match whatever you just used in the article which invokes the fast and easy email form.

 

(Thanks to Alzibiff for this tip)

If you see a T_STRING required on line 65 error, check and see if your server is runing PHP 4. This module uses Object Oriented Programming and won't work in PHP 4!

 

(Thanks to Tom for this one)

When I first installed the {loadposition user99} in an article, I copied the line of code from this page and pasted in into the editor in WYSIWYG mode. The editor inserted some extra html that was not displayed so the code looked OK but would not work. Once I edited the HTML and took out the /span statements, everything worked great. Maybe to is obvious but to noobs like me it all takes extra time. Thanks.

 

If the CAPTCHA image does not appear

FIRST -- check the tips above and make sure you've gone through all of that!

Q: The permissions on the actual captcha image are not getting set to allow it to display. The directory permissions are OK and when I check the recurse into subdir the captcha image permission update and it becomes visible on my website. How do I control the file permissions on the captcha image?

A: Check with your system adminstrator to make sure that the Joomla user's "umask" value is set properly. This is a file system issue and has nothing to do with the module!

Q: Thanks so much for the quick reply. This is my first Joomla website so I'm climbing a steep learning curve right now. My site is hosted at Network Solutions and they said they are not able to change the unmask parameter for security reasons. It appears that my /images/captcha directory has all the permissions necessary (777) but the image file is not accessible until I manually change the permissions, from 644 to 777. It seems odd that the file does not inherit the directory permissions. I'm kind of stuck at this point so I guess I'll keep hacking until I find a solution.

OK, so as I'm writing this message, I was testing and have found something new. It looks like if I use the Joomla Preview, the captcha file perms are set to 640 and do not display. If I view from a separate browser session, the permissions are set to 644 and it works. I also tested from a Macbook Pro with Safari and it worked, perms set to 644. Joomla Preview might be the culprit.
 
If you have errors with attachments
 
You might see a message like this:
Warning: move_uploaded_file(/Attachments/Logo Lettering.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/www/xyz/modules/mod_simpleemailform/mod_simpleemailform.php on line 157

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpgSqqOt' to '/Attachments/Logo Lettering.png' in /home/www/xyz/modules/mod_simpleemailform/mod_simpleemailform.php on line 157
 
1. Login as your Joomla administrator
2. Go to Extensions - Module Manager and select the simple email form module
3. Under Directory to Save Attachments enter a directory path which exists, and also one in which the module has the rights to create a file.
 
One recommendation would be to go to the Joomla Media Manager, create a folder for your uploads, and use the path displayed by Joomla.
 

 

If you see this appearing after posting a form:

Upgrade to the latest version (1.1.08 or above). The error occurs when you've implemented Joomla anti-spam security. One of these security measures intercepts any attempt to display a "raw" email address (i.e. This e-mail address is being protected from spambots. You need JavaScript enabled to view it ) and converts it into a javascript representation. The simple email module does not allow <script> tags and accordingly displays the javascript code instead of the email address. Fixed in 1.1.08.

 

If you do not receive emails after posting the form:

 

The Simple Email Form module uses Joomla mail.  There are several reasons why you might not be receiving email after posting the form.  Please review these steps before asking me for help!!!

  • Check your Joomla configuration and make sure you're set up properly for mail
  • Does your server have "sendmail"?  If not, then PHP mail (and the module) will not work.
  • Are you running on a test server which is local?  Do you have a full Mail Transfer Agent installed (i.e. exim)? 
    -- If not, then your server cannot send mail, which means the module won't work.
  • Is your ISP blocking ports so that you are not able to send mail?  (Some of them do, trust me!!!) 
    -- If so, contact your ISP and resolve the situation
     

You can click here to download a tool email_test.zip.  Unzip the file somewhere off your document root and then run email_test.php.  It's a simple PHP email program which you can use to test to see if your server is able to send email from PHP.

 

If you have problems posting new articles after running the simple email form module:

 

Upgrade to version 1.1.09 or above.

The problem was due to a bug in earlier versions where the default date/timezone was set to a fixed locale.  This was fixed in 1.1.09 by eliminating the setting and using Joomla's built-in date API instead of using straight PHP function calls.

 

If after posting a form you see mangled text when using international character sets:

 

Symptom: after posting a form you see something like this: ��α�α� in the input fields.

Solution: Upgrade to 1.1.10. 

Previous versions used 'htmlentities()' which does not have good support for multibyte character encodings.  1.1.10 switched to 'htmlspecialchars()' which has better support.

 

 

Bugs

[2012-12 -- thanks to Monique]

I tried using "Text" Captcha, has same result. It keeps telling me to fill in captcha again and again!

FIXED: version 1.8.0
This version no longer uses JSession but instead codes a hashed hidden field which is checked upon form submission.
 

[2012-02-15 -- thanks to Gregorio]

Hi Doug, I am trying to get your very nice module and I am getting the 
> following error message above the form after successfully sending the 
> email(see pic below)
> "Invalid address: Invalid address: Invalid address:"

FIXED: version 1.7.04


> Is there any chance you could help me to solve this issue?

[2011-12-19 -- Bruno from Italy!] Warning:
      require_once(): open_basedir restriction in effect.
      File(/usr/share/php/PEAR.php) is not within the allowed
      path(s): (/tmp:/var/tmp:/home/web/www.company.com/www) in
      /home/web/www.company.com/www/modules/mod_simpleemailform/CAPTCHA.php
      on line 22 Warning: require_once(/usr/share/php/PEAR.php):
      failed to open stream: Operation not permitted in
      /home/web/www.company.com/www/modules/mod_simpleemailform/CAPTCHA.php
      on line 22 Fatal error: require_once(): Failed opening
      required 'PEAR.php'
      (include_path='.:/usr/share/php:/usr/share/pear') in
      /home/web/www.company.com/www/modules/mod_simpleemailform/CAPTCHA.php
      on line 22
     
FIXED in 1.7.01

[2011-08-29 -- Moses from Kenya!] Warning: Missing argument 4 for sendResults(), called in C:\wamp\www\some_path\modules\mod_simpleemailform\mod_simpleemailform.php on line 476 and defined in C:\wamp\www\some_path\modules\mod_simpleemailform\mod_simpleemailform.php on line 214 FIXED in 1.1.12 [2011-07-22 -- thanks to Rui Castro Lobo from Portugal!]I noted a little problem in the email received, the field1 and field2 have the same label (of field2) so I have corrected it. It would be nice that you corrected the original file, for others sake. Thanks. FIXED in 1.1.11 [2011-05-24 -- thanks to Stamatis for point this out with the Greek] i am using your module "Simple Email Form" in my joomla website version 1.5.23. I have installed the module successfully, but i used it in Greek language and when ι write in Greek in the fields, after form has been sent, the Greek letters are shown like "Chinese"  Ï�Ï�αÏ�αÏ�. FIXED in 1.1.10 [2011-05-05 -- thanks to Agostino Zanutto for spotting this one!] The bug can be quite serious if timing of posting articles is critical. "... on line 41 of mod_simpleemailform.php you set timezone, without reset to original system tz before exit. This can block publishing of new articles..." FIXED in 1.1.09 [2011-03-26 -- from Tom] Doug, thanks for your nice Joomla extension.  Could you check my page at http://www.name-changed-to-protect-the-innocent.com/index.php/mail-list?  When the form gets submitted, it yields a couple of errors like: < script language= ' maxlength=255 /> I notice someone else (http://goo.gl/ZQwy9) had the problem, but no solution was posted. FIXED in 1.1.08

 

[2010-05-19 unconfirmed -- made changes which should fix any upload problems]
After I upload file (file is uploaded) in From field is fragment of code:  
FIXED in 1.0.5

[2010-07-12 -- from Dean]
I have noticed that your module shows the same captcha in IE/Opera and Firefox when Joomla site cacheing is turned on. However with your module it causes confusion and problems on the submit. The method I am using it is this: I have the module in a spare position called 'contact' and I'm calling it in a content item with {loadposition contact}  The form shows up and works in FF. If I open up Opera I see exactly the same captcha. I also see the same in IE. When the form is submitted IE has a wobble and eturns a blank screen, Opera does not like the captcha and tells you so, a page refresh can return the same captcha. I turn off site cacheing and it all works well.
FIXED in 1.0.6

[2010-08-02 -- from Ian]
When CAPTCHA is entered incorrectly, all text below the error message appears in red.
FIXED in 1.0.7 

[2010-08-03 -- from Muneca]
error: Warning: rand() expects exactly 2 parameters, 1 given in /hermes/bosweb/web152/b1523/d5.dangerou/public_html/lamunecarocks.com/modules/mod_simpleemailform/mod_simpleemailform.php on line 423
FIXED in 1.0.8


 
 

Version History: http://joomla.unlikelysource.net/index.php/simple-email-form-version

 

Last Updated on Thursday, 16 May 2013 22:27
 
Joomla templates by a4joomla