O'Reilly logo

Joomla! 1.5 JavaScript jQuery by Jose Argudo Blanco

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Warning

Much work should be added to this example to make a real world application of it, such as adding better security and error support.

An easy to add security measure would be to use the JMailHelper class:

http://api.joomla.org/Joomla-Framework/Mail/JMailHelper.html

This class can help us check if we are using a proper e-mail, or check that no headers have been injected in the subject, body, and so on.

For example, in our module, if we want to check that no headers have been injected in our body, we could do it like this. The following excerpt is from the modules/mod_littlecontact/helper.php file:

jimport('joomla.mail.helper');
            $body = JMailHelper::cleanText($body);
            $mail->setBody($body);
        

First we import the helper class, then we use the cleanText ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required