I'm working with the P&T contact form plugin: https://github.com/pixelandtonic/ContactForm

And I can't figure out how to add additional fields to my email, where do I add the additional field to the email template?

Thanks is advance.


Error Message:

Internal Server Error
Property "Craft\ContactFormModel.company" is not defined.

HTML Email Form:

$email->body = "Your Name: ".$message->fromName."\n\nCompany:\n\n".$message->company."Email Address: ".$message->fromEmail."\n\nPhone Number: ".$message->phone."\n\nRequests: ".$message->message;

4 Answers 4


I'd start by reading the "Adding Additional Fields" part of the docs. ;)

  • I've read the "Adding Additional Fields" and they don't appear on my email. The only fields that are on my email are: email and message. Also, to add: I have message[phone] and message[company] on my form, but they don't submit to my email.
    – Zachary
    Commented Jan 16, 2015 at 21:42
  • Can you edit your original question and include the email form HTML?
    – Brad Bell
    Commented Jan 16, 2015 at 22:22
  • Wait... so you're modifying the plugin's PHP code? If you follow the directions I linked to, that won't be necessary.
    – Brad Bell
    Commented Jan 16, 2015 at 22:35
  • Without, the only fields that are displayed is name, email and message. I must be missing something here. I've also did a copy-and-paste of the instruction with the same results.
    – Zachary
    Commented Jan 16, 2015 at 22:42

I am a few years late, but I think your problem may be that you are labeling your message body with name="message", instead of name="message[body]" as you should if you use custom fields. This way, you should not be coding PHP yourself.

Here is an example with a default field, a custom field and the message body field:

<input type="text" id="from-name" type="text" name="fromName" value="{{ message.fromName ?? '' }}">

<input type="text" id="phone" type="tel" name="message[Phone]">

<textarea id="message" name="message[body]">{{ message.message ?? '' }}</textarea>

I was having similar issues and was able to add some additional fields per the documentation Brad had mentioned. However, I found this post and it helped me print out the name and email address into the body of the email. Hope this helps someone.


@Clint Hubbard jr If you need the email and the fromName in the html message body this can also be done without an extra plugin, using jQuery. Insert two extra hidden fields:

<input id="body_name"type="hidden" name="message[Name]" value="">
<input id="body_email"type="hidden" name="message[Email]" value="">

Use the standard fields in the contact form:

<input id="fromName" type="text" name="fromName" required >
<input id="fromEmail" type="email" name="fromEmail" required >

Then jQuery:

$("#fromName").change(function() {
var myText = document.getElementById("fromName").value;
$("#fromEmail").change(function() {
    var myText = document.getElementById("fromEmail").value;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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