• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: change recipient for user email based on field val

change recipient for user email based on field val 9 years 5 months ago #33006

  • mattsson
  • mattsson's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 3
Note to moderator: I'm not sure there is any NEW info in this post after AlexP's answer. It's a follow up to this post: www.rsjoomla.com/forum/37-rsform-pro/264...ened-to-my-post.html. I just want to see if TODAY I get the white screen with smiley face OR the post actually succeeds into the forum.

Hello,

Andrei Cristea answered this support question for me. I think the answer would be helpful to others, so I'm copying the thread to the public forum. The posts are arranged newest at the top, original question at the bottom. Some URL's and emails have been changed for privacy.

Also this link from the RSForm!Pro support documentation covers this topic in a more general way, with more examples: www.rsjoomla.com/support/documentation/r...p-email-scripts.html

I'm using Joomla 3.4.3

15/09/2015 22:28:09
Carol Mattsson wrote:


Your answer works just fine for me. Thank You! And thank you for answering so promptly.

FYI, here is my new code in the PHP mail scripts section, additional emails box:

if ($_POST['form']['Send To Me'] == "Yes") {
   // Keep this in while testing
    //$additionalEmail['to'] = "dino@example.net";
} else {
   // Don't send the email.  RSJoomla says empty these two values and the email will not be sent.  CEM 9/15/2015
   $additionalEmail['to'] = NULL;
   $additionalEmail['from'] = NULL;
}

--Carol

15/09/2015 10:06:27
Andrei Cristea wrote:

Hello,

In order for the email to be generated you will need to have valid email addresses or placeholders that return valid email addresses in both the "To" and "From" fields. You could try adding a script in `PHP Email Scripts" that will check the user's input and if an email should not be sent empty the following values:

$additionalEmail['to']

and

$additionalEmail['from']

Regards!

15/09/2015 00:29:44
Carol Mattsson wrote:


Hello,

I have successfully set up an "Additional Email" to be sent when my form is submitted. However I want to send this email only if a certain radio button on the form is ticked.

I have successfully set up a PHP script that can change the email address to which this additional email will be sent, according to the value of that certain radio button. I do that by altering the value of a hidden variable in my form. The hidden variable is supplied as the "to" address of this additional email.

Here is a snapshot of my form:
www.dropbox.com/s/l7qypi2boivatl1/rsjoom...mail-option.JPG?dl=0

For now I've set this address to a non-working email address when I don't wish the additional email to be sent out. But is there a better, more elegant way to handle this situation? I'd rather find a way to NOT send out an email at all, based on the value of that radio button.

Here is my script (called on form process):

if ($_POST['form']['Send To Me']) {
   $_POST['form']['PGE Notify Email'] = "dino@example.com" ;
} else {
   $_POST['form']['PGE Notify Email'] = "bit-bucket@example.com";
}

Any suggestions?

Thank you.
--Carol Mattsson
The administrator has disabled public write access.

change recipient for user email based on field val 9 years 5 months ago #33007

  • mattsson
  • mattsson's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 3
Yay, it looks like my post succeeded! Maybe something was wrong with the forum software the other day. The moral of the story is:

* Save your post to a separate text file "just in case"

* If your post submittal fails with a white screen with just a smiley emoticon, it means your post failed. Try again later.

* If you get a success message, a new URL AND your post with all the bb-edit rendered, your post succeeded.

--Carol
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!