Hi all
Hi have a form with a select button for a request to 3 differents departments.
Thank you for the help.
Here is my PHP that I would to use to send the email to the differents departments.
<?php /* THIS FILE USES PHPMAILER INSTEAD OF THE PHP MAIL() FUNCTION */ require 'PHPMailer-master/PHPMailerAutoload.php'; /* * CONFIGURE EVERYTHING HERE */ // an email address that will be in the From field of the email. $mail->CharSet="UTF-8"; $fromEmail = '[email protected]'; /* company website*/ $fromName = 'Site web'; // subject of the email $subject = 'Nouveau message fomulaire du siteweb'; // form field names and their translations. // array variable name => Text to appear in the email $fields = array('nom_id' => 'Nom', 'email_id' => 'Courriel', 'depart_id' => 'Adressé à', 'message_id' =>'Message'); $mail->Body = array('nom_id' => 'Nom -', 'email_id' => 'Courriel -', 'depart_id'=> 'Adressé à', 'message_id' =>'Message'); //, 'phone' => 'Phone', 'email' => 'Email', 'message' => 'Message' // message that will be displayed when everything is OK :) $okMessage = 'Votre demande a été soumis avec succès. Merci, I will get back to you soon!'; // If something goes wrong, we will display this message. $errorMessage = 'There was an error while submitting the form. Please try again later'; /* * LET'S DO THE SENDING */ // if you are not debugging and don't need error reporting, turn this off by error_reporting(0); error_reporting(E_ALL & ~E_NOTICE); try { if(count($_POST) == 0) throw new \Exception('Form is empty'); $emailTextHtml = "Message du formulaire contacte du siteweb
"; $emailTextHtml .= "
$fields[$key] | $value |
---|
"; $emailTextHtml .= "
Merci!
Passez une belle journée.