Jump to:

10987 Posts in 2724 Topics by 1817 members

All other Modules

SilverStripe Forums » All other Modules » UserForm to send out unique/dynamic email subjects?

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1037 Views
  • Mohammed
    Avatar
    Community Member
    25 Posts

    UserForm to send out unique/dynamic email subjects? Link to this post

    We are using the UserForm module. Is there a way for the form e-mail subject to contain user submitted data? We need each e-mail that is submitted using an online form to contain a unique subject so the form response does not get incorrectly grouped. (When using Google's Gmail "Conversation View", emails of the same subject/topic are grouped together)

    If someone know's of a workaround, please let us know. That would be awesome!

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: UserForm to send out unique/dynamic email subjects? Link to this post

    In code/UserDefinedForm.php, on line 592, edit this:

    $email->setSubject($recipient->EmailSubject);

    You could do something like this:

    $email->setSubject($recipient->EmailSubject." - ".$submittedFields->find('Name', 'EditableTextField1')->Value);

    In order to find the field you want to insert, you'll have to do this a few lines above:

    print_r($submittedFields); die();

    And do a test submit of your form to get the raw data and pick out the name of the field you want to use in the email subject.

  • Mohammed
    Avatar
    Community Member
    25 Posts

    Re: UserForm to send out unique/dynamic email subjects? Link to this post

    I tried to make the changes you suggested, however, I was not able to get it to work...Do you have any other ideas? :-/

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: UserForm to send out unique/dynamic email subjects? Link to this post

    Well, why didn't it work? Paste your code here and let's see, and don't forget to mention which form field you are trying to use in the subject.

    1037 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.