6

I'm currently working with the Contact Form plugin from P&T. I don't need much more, but as usual the client wants to:

  • See the email address and name in the body of the mail (he won't understand the way it works now).

Is there a way to get this done?

2 Answers 2

4

I ended up hacking the ContactFormService.php file with some extra code for the body

It's actually quite simple:

$email->body = "Sender: ".$message->fromName."\n\nEmail-addreas: ".$message->fromEmail."\n\nMessage: ".$message->message;

Same thing for cc mail

I understood 2.2 will have a plugin hook for this kind of added functionality (emails.onBeforeSend event)

2

Your options are either:

1) Hack the plugin to get it to add name and email to the body.

2) Use a more robust form-building plugin.

3) Use JavaScript to add a hidden input to the page that will add it to the body so they don't have to enter an email twice. Something like:

<input id="emailCopy" type="hidden" name="message[emailCopy]" value="[email protected]">
4
  • This would be a great use-case for a plugin-hook.
    – Victor
    Commented Jul 25, 2014 at 17:02
  • @VictorIn Yup... not a bad idea.
    – Brad Bell
    Commented Jul 25, 2014 at 17:23
  • I've had all three options in my mind. Was hoping there would be some functionality available (the sprout plugin might be to much and is still in development). I've seen a hack here, craftcms.stackexchange.com/questions/376/… that might help a bit. A hook would be better yes, as a designer I'm not sure if that fits my bill
    – noregt
    Commented Jul 25, 2014 at 18:02
  • I've managed to hack the plugin so that it shows the sender and name. I've asked a developer to do this with a plugin hook, but that appears not to be possible. He needs an added emails.onBeforeSend event to the event list to do that. Is there a way that can be done (feature request I think?)
    – noregt
    Commented Jul 31, 2014 at 8:58

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.