Contact forms¶
Forms are made up of fields (text, list, etc.) and a button that will send this information to the server.
The default behaviour of the form is to send an email to your email address.
Creating a form¶
The creation is very simple, a form button (Send button) and the fields of your choice
The sending itself is then done via your hosting,
Simple submission of a form¶
The default sending system simply requires you to enter your email address (To).
Tip
Save time by entering your email address in the general properties of your site so that you don’t have to enter it each time you create a new form.
The upload does not work with my host¶
You do not receive the email or an error occurs during the sending.
There are limitations with some hosts.
Contact your web host and ask them for a working PHP code.
You can directly test the following PHP codes with the customised upload in WebAcappella
If the code works, do not hesitate to contact us to possibly add parameters in WebAcappella to facilitate the use of the forms.
Warning
We do not provide technical support for uploading problems, as they are dependent on the operation or configuration of the hosting. This page should help you in case of problems:
Personalized sending with the mail function¶
If you have some knowledge of PHP you can fully customise the sending of the form with the PHP mail function
https://www.php.net/manual/fr/function.mail.php
Classic PHP example of sending mail
<?php $message ="Mon message "; $result= mail( "adresse@fai.com", "Test WebAcappella form", $message); echo json_encode(['success'=>$result,'message'=>"Error occured"]);
Tip
The personalised sending allows you to test directly any particular settings of the mail function that your host will have given you
Personalized sending with the PHPMailer library¶
Below is an example of more advanced code using the PHPMailer library.
PHPMailer is an open source library used worldwide in most CMS.
You can use this example to check that your host correctly supports sending mail independently of WebAcappella
<?php $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->From = "monmail@domain.com"; $mail->AddAddress("monmail@domain.com"); $mail->Subject = "My subject"; $mail->Body = "Texte Body"; $result = $mail->send(); echo json_encode(['success'=>$result,'message'=>$mail->ErrorInfo]);