× Form Help

Alternate Email Recipient

  • tyekynan
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 60
  • Karma: 1
  • Thank you received: 2

tyekynan created the topic: Alternate Email Recipient

We have been very busy at work, and we are considering adding another person to help answer emails from a specific form that we have.

What I would like to do is alternate the recipient on the form. For example:

Form is submitted and sent to person1@website.com
Form is submitted again and sent to person2@website.com
repeat.

So every form sent is split between 2 email addresses.

If this isn't possible, is there a way to add a 1 or 2 to the subject line and have it alternate for each submission, so I can filter it within gsuite? I am not sure how to handle this problem of wanting the emails to alternate which address the forms are sent to, but I am trying to create a solution.
Thanks, as always.
#239030
  • Posts: 3119
  • Karma: 104
  • Thank you received: 409

mihaela replied the topic: Alternate Email Recipient

Hello,

Do you want that form is sent to both email addresses?

If that would work for you, in your form Properties in the "Email recipient(s)" field you can enter more email addresses, separated by semicolon.

Would that solution suit you?

Regards,

Mihaela
#239050
  • tyekynan
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 60
  • Karma: 1
  • Thank you received: 2

tyekynan replied the topic: Alternate Email Recipient

Negative, I need the emails to alternate to the addresses as each email would push a potential client to one employee or the other, not both. I use zapier, I believe if I have a way to put in some sort of ID based on submitted records, I can use a webhook and filter that id. Please advise.
#239060
  • Posts: 3119
  • Karma: 104
  • Thank you received: 409

mihaela replied the topic: Alternate Email Recipient

Hello again,

Ok, I understand now.

What you could do is you could count the number of records and add a field in your form where this count will be displayed. Here it is explained how to do so crosstec.org/en/blog/939-count-number-of-records.html .

Then you might use this count in zapier if you know how.

My idea would be to define your email in the End Submit pieces as follows.

You would have to go to form's Advanced properties > More options > Submit pieces and in the End Submit pieces set Type to Custom.
In the code area below you would put a code like this:
$this->execPieceByName('ff_InitLib');

// get the ID of that last record
$db = JFactory::getDBO();
// replace MyFormName with the name of your form
$db->setQuery('Select Id From #__facileforms_records Where name="MyFormName" BY id DESC');
$id = $db->loadResult();

// Define email
$from = 'test@test.com';
$fromname =  'yourname';
$subject = 'mysubject';

// Here you define the body of email
$body = '';
foreach ($this->maildata as $data) {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
}


// send mail to a different recipient based on whether the id is odd or even number
$recipient1 = 'person1@website.com'; 
$recipient2 = 'person2@website.com'; 

if($id % 2 == 1) {
    $this->sendMail($from, $fromname, $recipient1, $subject, $body);
}
else if($id % 2 == 0) {
    $this->sendMail($from, $fromname, $recipient2, $subject, $body);
}

This will make it work in a way that records with odd ID will go to 'person1@website.com' and records with even number to 'person2@website.com'.

The thing is, that if you wish to use a Custom email template it will be a bit more demanding since you would have to write custom code.

Let me know whether this works as you wanted.

Regards,

Mihaela
#239069
  • tyekynan
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 60
  • Karma: 1
  • Thank you received: 2

tyekynan replied the topic: Alternate Email Recipient

Im not great at code, but I suspect that this only works if I am using email notification?

My original thought was:

FIll out form>
catch webhook with zapier>
filter with zapier
If ID ends in 1,3,5,7,9 send to email 1 via gmail
If ID ends in 0,2,4,6,8 send to email 2 via gmail

Is there anyway to input the record id into a hidden field on submit?
#239278
  • tyekynan
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 60
  • Karma: 1
  • Thank you received: 2

tyekynan replied the topic: Alternate Email Recipient

Anything?
#239385
Moderators: ForumSupporttomeperica
Time to create page: 0.080 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here