Forums

dynamic To not working in conditional email action

Ensman 17 Apr, 2012
Hi,
I am having a problem with using a dynamic "to" address. I'm using the custom conditional email action with a ModelId. It seems as if {comm.email} doesn't work in the To field (it's just ignored), but it does work in the Template field (see below). comm is the ModelId I'm using. The condition-checker and everything else is working, and an email is sent if I use a hardwired email address instead.
Maybe I'm missing something simple or there is a bug!
L.E.

Here are the debugger messages (email addresses, etc. edited for privacy):

Data Array:
Array
(
[tmpl] => component
[event] => submit
[Itemid] => 147
[option] => com_chronoforms
[view] => form
[comm] => Array
(
[cf_uid] => 6a54529cab3036a368f53c6f422ebf69
[cf_created] => 2012-04-16 18:30:04
[cf_ipaddress] => 98...
[cf_user_id] => 43
[RErequestID] => 3
[RErequestTbl] => joom_chronoforms_data_MaintenanceRequest
[comm_date] => 2012-04-16 18:11:38
[mode] => email
[to] => [email]xxx@indiana.edu[/email]
[to_cc] =>
[from_name] => xr
[from_email] => [email]xr@gmail.com[/email]
[REmsg] =>
[about_unit] => 50
[comm_subject] => RE: Need some work done (MRF#3)
[comm_message] => We'll get to it ASAP!
[comm_notes] =>
[email_sent] => yes
[comm_id] => 55
)
[okToSend] => yes
[comm_comm_id] => 55
)
----
Email errors
No valid To Email address found
Email info
Email send stopped.
From: (website) [email]webmaster@site.com[/email]
To:
Subject: RE: Need some work done (MRF#3)
Email body
comm.to: [email]xxx@indiana.edu[/email] We'll get to it ASAP!
-----
My settings in the action are:
To (required) = {comm.to}
Subject = {comm.comm_subject}
From name = website
from email = [email]webmaster@site.com[/email]
cc = {comm.to_cc}
Reply to name = {comm.from_name}
Reply to email = {comm.from_email}

Template = comm.to: {comm.to} {comm.comm_message}
-----
GreyHead 17 Apr, 2012
Hi Ensman,

Hmmm . . . It's quite possible that it doesn't recognise the model id. I've never been asked the question before and will need to look at updating the code. Meanwhile, as a workaround, you could use a Custom code action to put the value directly in the $form->data array. I think that this will do it
<?php
$form->data['to_email'] = $form->data['comm']['email'];
?>


Bob
Ensman 17 Apr, 2012
The work-around worked just fine. Thanks!

However, I discovered that 'Reply To' is not working as it should either.
If I use 'Reply To Email' = {comm.from_email} (similarly for 'Reply To Name'), the message is sent with 'Reply To' set equal to what I had put in 'From Email'. The trick that worked for 'To' does not work here - I get the same result using {from_email}, ie, 'Reply To' is set equal to 'From'. If I type in a particular email address instead, then 'Reply To' in the message that is sent gets sets to that AND the address in 'From'.

I'm trying to set 'From' to [email]webmaster@mysite.com[/email] and 'Reply To' to an individual's email address. I think that is the preferred way to do it, correct? When the recipient gets the email, I want them to be able to reply to the individual's email address only.

If more specifics would be helpful here or if I should start a new thread, let me know.
Thanks so much,
L.E.
GreyHead 22 Apr, 2012
Hi Ensman,

I've updated the Email [GH] action to support nested values like {comm.from_email} in all of the email boxes including the Reply To box.

I've also enabled multiple Reply To addresses you can add a comma separated list or a curly bracket placeholder for a dynamic array.

Lastly I found a fix for the bug that added the Admin address alongside a Reply To address.
Please try it out and let me know if you find any problems.

Bob
Ensman 24 Apr, 2012
Everything seems to be working now! Thank you so much!

I also found the thread that talked about how to fix joomla's mail.php so that From would not be added to Reply To, so that is fixed also. (Should that fix still be needed?)
GreyHead 25 Apr, 2012
Hi Ensman,

No, the fix shouldn't be needed with the latest version of the Email [GH] action.

Bob
This topic is locked and no more replies can be posted.