TOPIC:

specific email conditioned 3 weeks 21 hours ago #242670

  • Topic Author
  • Philroque
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 16
  • Thanks: 0
hi,

On the 1st page of my form, I know the user's email and I have a radio button, if it is "yes" I would like to be able to send them a specific email (this is not a copy of the form) but a simple email (text and links) once the form is validated.
Tell me how I could get there, if possible?

Thanks for your help

Please Log in or Create an account to join the conversation.

specific email conditioned 3 weeks 20 hours ago #242672

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 233
  • Karma: 3
  • Thanks: 40
Hi,

I hope I understood you well. I am not tested it, but I will send you example.

1) In Properties of your form uncheck the [/b]Mail notification [/b] checkbox. Also, in the Advanced options of element where user enters his email uncheck the [/b]Mailback[/b] checkbox if it was checked. It is necessary to turn off these email notifications in order for this to work.

2) Go to Advanced options of your form ->More options -> Submit pieces -> End Submit, set Type to Custom and in the code area below paste the following code:
$this->execPieceByName('ff_InitLib');
$from = 'address@domain.com';
$fromname = 'From Name';  //name of sender of mail

$subject = 'Your Email Subject'; // Change to your preferred Email subject

$recipient = ff_getSubmit('email');  

$sel = ff_getSubmit('radioname'); // replace radioname with the Name of your radio button element

$body = '';
foreach ($this->maildata as $data) {
  $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n"; 
}

$isHtml = true;

$this->sendMail($from, $fromname, 'adminemail@test.com', $subject, $body);  // replace adminemail@test.com with your admin email
//that line of code sends submitted data to the admin email

$this->sendMail($from, $fromname, $recipient, $subject, $body); //this line of code sends submitted data to the email address that user has entered in email field of your form

//Define content of the  emails
$body1 = 'This is the first email, here you can add your text;
if($sel == "value1") {
$this->sendMail($from, $fromname, $recipient, $subject, $body1, $isHTML);  }

//in the code above replace value1 with value of option in your radio button

Please follow these, and replace with correct data of your form.

Let me know if it helps.

Regards,
Tihana
The following user(s) said Thank You: Philroque

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

specific email conditioned 3 weeks 17 hours ago #242681

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
...let me make a small addition, maybe you can achieve it simpler:

If you retrieve the email address from an email field, enable "mailback" in its advanced tab. This will send the user a copy of what he entered by default.

To actually just add some text and links, you can go to form => advanced => more options => mailback emails => enable edit emails and add your text and links.

This setup will then act as a template and replace the default.

You also might want to enable HTML emails there, so the links look nice.

Regards,
Markus
The following user(s) said Thank You: Philroque

Please Log in or Create an account to join the conversation.

Last edit: Post by TheMuffinMan.

specific email conditioned 2 weeks 6 days ago #242726

  • Topic Author
  • Philroque
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 16
  • Thanks: 0
Hello to both of you,

Thank you Markus for this solution but it does not correspond to my request, the email will be sent to any user and this is not the option I precisely want.

Thiana, it seems that the email looks like a copy of the response to the form, with all the fields of the form.
I would like to have in the email only the name and value radio button in question and my text and links. my text and links are not currently appearing.
Also I would like to remove in the header of the email this information which has no interest for the user:

-Reply-To: From Name <address@domain.com>
-Message-ID: <eab66b5d6757@monsite.test>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=utf-8
-Content-Transfer-Encoding: 8bit


Do you see how to correct?

Thank you again for your help

Please Log in or Create an account to join the conversation.

Last edit: Post by Philroque.

specific email conditioned 2 weeks 6 days ago #242728

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 233
  • Karma: 3
  • Thanks: 40
Hi,

Sorry for my mistake, this part of code displays all field from form:
$body = '';
foreach ($this->maildata as $data) {
  $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n"; 

If you just need certain fields you can do it like this, please replace above parts of code with this:
foreach ($this->maildata as $data) {
  if( $data[_FF_DATA_TITLE]=='SomeElementName'){
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl();
  }
}
Please replace 'SomeElementName' with name of field with you want display.

Let me know if it helps.

Regards,
Tihana

Please Log in or Create an account to join the conversation.

specific email conditioned 2 weeks 5 days ago #242760

  • Topic Author
  • Philroque
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 16
  • Thanks: 0
hello Thiana,
no, I no longer have to apologize, I should have detailed my request better.
Following your advice, the form no longer sends emails. Surely something this time that escapes me ..
here is the modified code:
$this->execPieceByName('ff_InitLib');
$from = 'address@domain.com';
$fromname = 'From Name';  //name of sender of mail

$subject = 'Your Email Subject'; // Change to your preferred Email subject

$recipient = ff_getSubmit('email');  

$sel = ff_getSubmit('lien'); // replace radioname with the Name of your radio button element

foreach ($this->maildata as $data) {
  if( $data[_FF_DATA_TITLE]=='lien'){
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl(); 
}
}

$isHtml = true;

$this->sendMail($from, $fromname, 'adminemail@test.com', $subject, $body);  // replace adminemail@test.com with your admin email
//that line of code sends submitted data to the admin email

$this->sendMail($from, $fromname, $recipient, $subject, $body); //this line of code sends submitted data to the email address that user has entered in email field of your form

//Define content of the  emails
$body1 = 'This is the first email, here you can add your text;
if($sel == "oui") {
$this->sendMail($from, $fromname, $recipient, $subject, $body1, $isHTML);  }

//in the code above replace value1 with value of option in your radio button



The radio element "lien" is defined like this:
1;Non;non
0;Oui;oui

If checked at "oui" it validates the sending of this email.

Do not pay attention to emails, for testing this does not matter because I am local and I intercept all emails sent by Joomla !.


Thank you again for your help

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.091 seconds

July Sale!

Discounts for all of our extensions + support. Ending July 31st!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!