I've tried creating a contactform.php file with the P&T Contact Form plugin and using the code in the documentation to be able to programmatically add recipients. However, when I use this code:

    namespace Craft;

    $toEmail = craft()->request->getPost('toEmail');
    $toEmail = craft()->security->validateData($toEmail);

    return array(
        'toEmail' => ($toEmail ?: null),

I end up getting a white screen of death and a 500 Internal Server Error. I don't know why it's doing this, I tried editing the permissions of my craft folder and the contactform.php file, but nothing has worked and I keep getting a white screen.

How can I fix this? Thanks!

  • If you enable devMode, instead of a white screen, you should get a nice error message with a stack trace. If you don't, can you edit the original question to include your contactform.php file? – Brad Bell Aug 13 '16 at 1:53
  • I used the code that I included above and I did also try devMode, but I couldn't get any errors. Where should I go from here? Would there be any problems related to the comma and ellipsis in the array? It was originally included in the source code in the documentation... either way, are there any other things I can try? – Jesse Winton Aug 13 '16 at 6:05
  • Yeah, if you don't get any errors with devMode enabled, then it's probably a PHP syntax error in your contactform.php file, which is why I asked if you could edit your original question with the contents of that file. ;) – Brad Bell Aug 14 '16 at 2:04
  • Thanks. Like I said though, what I included above is the complete contents of the contactform.php. :) is that not what you need? – Jesse Winton Aug 14 '16 at 2:06
  • lol, no that's it. I'm just dense. Will add an answer. – Brad Bell Aug 14 '16 at 2:07

The problem is the ... in your contactform.php file.

The docs use it because they assume you might have some other valid config settings you want to include in that config file, but it's not real code, which is why PHP is choking on it.

Remove the ... and you should be set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.