Contact forms

Forms are made up of fields (text, list, etc.) and a button that sends this information to the server.

The default behavior of the form is to send an email to your email address.

Creating a form

Creation is very simple: a form button (Send button) and the fields of your choice

../../../_images/sample_form.png

The actual shipment then takes place via your hosting,

Simple form submission

The default sending system simply requires you to enter your e-mail address (To).

Tip

Save time by entering your email address in your site’s general properties, so you don’t have to enter it every time you create a new form.

Sending does not work with my host

You don’t receive the e-mail or an error occurs when sending it.

There are limitations with some hosts.

Contact your web host and ask for a working PHP code.

You can directly test the following PHP codes code with the customized send in WebAcappella

If the code works, don’t hesitate to contact us if you’d like to add parameters to WebAcappella to make it easier to use the forms.

Warning

We do not provide technical support for shipping problems, as they depend on the vagaries of hosting operation or configuration. This page should help you in case of problems:

Mail sending problems

Personalized dispatch with mail function

If you have PHP skills, you can fully customize the sending of forms using the PHP mail function

https://www.php.net/manual/fr/function.mail.php

Classic PHP example of sending an e-mail

<?php

$message ="Mon message ";

$result= mail( "adresse@fai.com", "Test WebAcappella form", $message);

echo json_encode(['success'=>$result,'message'=>"Error occured"]);

Tip

Customized sending allows you to directly test any special mail settings provided by your hosting provider

Personalized mailing 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 hosting provider supports WebAcappella-independent mail sending

<?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]);