Contact_form error

ctdlg Member
edited September 2018 in Plugins

Hello,

My contact_form plugin does not send messages.
In the debug log, I get several errors like this one :
Undefined variable: mailcontent line xxx

This is from my form.php.
Using the original form.php, I get same errors.

Here is one line generating problem :
input type ... ... ?php echo html_encode($mailcontent['name']); ? ... ...
I did truncate the above line on this forum so that it displays correctly here, this is why I use ... ...

I use the zenphoto_sendmail extension. I did try the other mail extension -> same errors.
I'm under php 7.1.22.

Variables like $mailcontent['name'] are not declared, but it's probably not the problem.

When I press the "send" message, I get no error message and get a blank contact form.
I do not use captcha right now ... until it sends messages.

Comments

  • acrylian Administrator, Developer

    We would need to know the line you listed with "xxx". Also what settings have you set regarding the fields of the contact_form.

    It is generally working as we use it on our own site ourselves. And we do get mails occasionally.

  • ctdlg Member
    edited September 2018

    Yes, line 24 for example from original form.php does give me this error. But also line 86 ...

    I tried a simple php file, and it does send mail

    <?php $destinataire = 'me@test.fr'; // Pour les champs $expediteur / $copie / $destinataire, séparer par une virgule s'il y a plusieurs adresses $expediteur = 'test@test.fr'; $copie = 'other@test.fr'; $objet = 'Test du système '; // Objet du message $headers = 'MIME-Version: 1.0' . "\n"; // Version MIME $headers .= 'Content-type: text/html; charset=ISO-8859-1'."\n"; // l'en-tete Content-type pour le format HTML $headers .= 'Reply-To: '.$expediteur."\n"; // Mail de reponse $headers .= 'From: "Nom_de_expediteur"<'.$expediteur.'>'."\n"; // Expediteur $headers .= 'Delivered-to: '.$destinataire."\n"; // Destinataire $headers .= 'Cc: '.$copie."\n"; // Copie Cc $headers .= 'Bcc: '.$copie_cachee."\n\n"; // Copie cachée Bcc $message = '
    Un Bonjour de Test !
    '; if (mail($destinataire, $objet, $message, $headers)) // Envoi du message { echo 'Votre message a bien été envoyé '; } else // Non envoyé { echo "Votre message n'a pas pu être envoyé"; } ?>

    This means my server is OK.
    Running Zenphoto 1.5

  • acrylian Administrator, Developer

    I sadly don't really have time to dig into it right now. But the array $mailcontent should actually be defined with all indices even empty when the form is called. Within the printContactForm()

  • Well, thank you very much, again !

    Your suggestion printContactForm() helped me a lot

    It works with your help : I found a post saying that it was working with codeblocs
    So I wrote a simple article with
    <?php printContactForm(); ?>
    in the codeblock section.

    Message confirmation appears -> message sent ... and I did receive it.

    Again, thank you. I do appreciate your help.

  • acrylian Administrator, Developer

    Now I am curious how you used the plugin actually. Is it possible that you left out some details above? If you use the standard contact.php page it should be working out of the box the same way.

  • Hello acrylian,
    I do use the standard contact.php file.
    It did not work because I called the form.php file !
    I call the contact.php file and it works.
    That was a misunderstanding from me !

Sign In or Register to comment.