Forums

[Solved] Setup emails - questions

lhudson 16 Mar, 2010
Hi,

I'm trying to set up a form (on local LAN only, using Xampp) where the user inputs some details, including their email address. This works fine, up to a point. But, I can't help wondering what I'm missing when things don't work.

What I need is for an email to go to a preset user, but with a dynamically created subject according to how the form is filled in.

I need to send the email "subject" in the following format.... the name of the user filling in the form followed by the text "- submission". So the subject would read "Joe Bloggs - submission" with the name being dynamic. To work this, I've set up the text "- submission" as a hidden field (hidden_24) and the user's name as text_1. So, in the "Dynamic Subject" box, I have "text_1 hidden_24" without the quotes. When the email arrives, the subject is blank.

Is there something I'm doing wrong? I have tried all sorts of different combinations, searched the forum and read the email tutorial, but can't figure out how to set this up to work. Can I have more than one dynamic field name in Dynamic Subject?

Cheers,
Lea
GreyHead 16 Mar, 2010
Hi Lea,

You can only have one variable name in the Dynamic Subject box.

But you can build that variable in the OnSubmit Before box. . .
<?php
$text_1 = JRequest::getString('text_1', '', 'post');
JRequest::setVar('subject', $text_1.' - submission');
?>

Then put subject in the Dynamic Subject box. (You can remove the hidden field as it isn't needed.)

Bob
lhudson 16 Mar, 2010
Hi Bob,

You're a gentleman and a scholar as we say in the UK! Thank you very much for the solution, it worked perfectly.

I'm still very much a beginner with PHP, so this is something I wouldn't have been able to figure out on my own.

Much appreciated.

Regards,
Lea
This topic is locked and no more replies can be posted.