You are here: start » mailform

The Mail Form

CMSimple_XH's mail form offers your visitors the chance to contact you via email. After form submission the email is sent via PHP's mail() function what already works on many webservers out of the box. However, some servers might need some tweaking, so it's best to test the mail form yourself, and ask the server admin resp. hosting provider to adjust the settings if necessary. From CMSimple_XH 1.6 on failed mail attempts are logged in the log file, so you should have a look at it from time to time.

Activation

To activate the mail form it is mandatory to enter your email address in Mailform → Email. Depending on the CMSimple_XH version you'll find that under:

  • Settings → Edit configuration (CMSimple_XH < 1.5)
  • Settings → Website (CMSimple_XH 1.5)
  • Settings → CMS (CMSimple_XH >= 1.6)

Note that Mailform → Email supports anything that is allowed as value of the To header field of an email, for instance:

webmaster@example.com
John Doe <webmaster@example.com>
John Doe <webmaster@example.com>, Jane Doe <admin@example.com>

Right beside this setting you find an option to enable resp. disable the mail form's CAPTCHA.

Most templates already display the link to the mail form; if your's doesn't you have to add the following code in an appropriate place:

<?php echo mailformlink();?>

Broken Emails

There are known issues regarding broken mail transfer agents (MTA), which don't deal correctly with linebreaks. The result is that the email body contains lines which don't belong there, usually starting with “From: …”, and the rest of the body being an unrecognizable mess of characters.

To fix this, cmsimple/mailform.php (CMSimple_XH 1.5) resp. cmsimple/classes/Mailform.php (CMSimple_XH 1.6) has to be modified. Feel free to ask in the CMSimple_XH Forum for details.

Since CMSimple_XH 1.6.2 there is a hidden configuration option to fix these issues. Just edit cmsimple/config.php and replace the respective line with:

$cf['mailform']['lf_only']="true";

Embedding

Usually the mail form is displayed on a separate page that is dynamically created by CMSimple_XH. This works fine and is sufficient for many purposes. If you want to add any informative text before or after the mail form, however, that is not possible. In this case you can embed the mail form on a normal page with the following plugin call (requires CMSimple_XH 1.6 or higher):

{{{XH_mailform();}}}

This is even possible on a page that is shown as newsbox.

Since CMSimple_XH 1.6.5 it is possible to alter the mail subject field preset by a parameter

{{{XH_mailform('myMailSubject');}}}

or by a variable in the query string

<a href="?mailform&xh_mailform_subject=Registration>Ask for registration</a>
<a href="?myMailformPageWithPluginCall&xh_mailform_subject=Registration>Ask for registration</a>

Note, that more than one mail form on the same HTML page may not work as expected. Since CMSimple_XH 1.6.2 at most one mailform is displayed in this case.

Styling

There are already several CSS rules regarding the mail form contained in css/core.css, and your template might override (some of) them. That may be already sufficient for your purposes, but of course you can add your own style rules, what is best done in the stylesheet of the template. The stand-alone mail form is wrapped in a DIV with the ID “cmsimple_mailform” (before CMSimple_XH 1.6) resp. “XH_mailform” (since CMSimple_XH 1.6). The embedded mail form has the class “XH_mailform”. For further details regarding the markup structure view the HTML source code (resp. use the developer tools of your browser).

Customization of the labels and captions of the mail form can be done under Settings → Language → Mailform.

Alternatives

If the built-in mailform is not sufficient for your purposes you may replace it with a plugin. Currently the following alternatives are available:

 
You are here: start » mailform
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Valid XHTML 1.0 Valid CSS Driven by DokuWiki