You are here: Home / Documentation / How To's / How to add a users name to an email from Plone Form Gen (pfg)

How to add a users name to an email from Plone Form Gen (pfg)

by ledwell published Feb 14, 2014 03:25 PM, last modified Aug 16, 2016 10:49 AM
Shows you how to make the email from a ploneformgen form contain the first and last name of the submitter in the "from" area or sender area.

In a PloneFormGen form you will notice that when someone submits a form that the email address of the Plone site appears in the "From" area of the resulting email. If you have a lot of submitters this can be a headache because you want to see the name of the person in "From" area of the email NOT the plone site email address. As long as you have form fields name "first-name" & "last-name" you can have that information appear in the "From" area. This is how you do it. 

  • Create a PloneFormGen form
  • Create two fields a "First" and "Last" name field (make sure you know what their short names are. In my case it was "first-name and last-name"
  • Open up your "Mailer" adapter
  • Choose "Overrides"
  • Put this expression in the "sender expression" string:${request/form/firstname} ${request/form/lastname} <${request/form/replyto} >
  • Of course if you only want one of those fields just don't include the one you dont want OR if you wanted the email of the person instead change the string such that its using the name of the email field.. ex string:${request/form/email} 



While this works in Apple mail. if you view this in "Gmail" you will see (unknown sender). So id suggest requesting the email field instead of the name if that will be an issue for you or your users.