TOPIC:

conditional mailbackfile 3 years 1 month ago #230225

  • Topic Author
  • gcom
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 101
  • Thanks: 0
I have a form where users can sign up to an event that takes place in two cities. The user can coose which event he wants to attend via radio buttons.
After submission of the form I want to send a confirmation mail with a pdf containing additional informations about the event in the city the user has selected before:
If he chooses city A the attached pdf would be a.pdf
if he chooses city B the attached pdf would be b.pdf
How can I accomplish this using BreezingForms?

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

conditional mailbackfile 3 years 1 month ago #230235

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

To send attachments in email depending on the radio group selection will require a custom solution since there isn't an option to simply set this.

Here is how to achieve what you want.

You have to go to Advanced options of your form > More options > Submit pieces and in the End Submit section, select Type Custom and there you have to create an email. Here is an example of the code that will do what you want:
$this->execPieceByName('ff_InitLib');
$from = 'your@email.com'; //change to wanted email
$fromname = 'yourname'; //change to wanted from name
$subject = 'Your Email Subject'; // Change to your preferred Email subject
$attachment = [];

$body = '';
foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'radiogroupname'){
   $ischeck =  $data[_FF_DATA_VALUE];
    if (strpos($ischeck, 'groupvalue1') !== false) {
        array_push($attachment , JPATH_SITE.'/media/breezingforms/pdftpl/a.pdf'); }
    if (strpos($ischeck, 'groupvalue2') !== false) {
        array_push($attachment , JPATH_SITE.'/media/breezingforms/pdftpl/b.pdf'); }
  }   

   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
 
}
$this->sendMail($from, $fromname, 'wantedemail@mail.com', $subject, $body, $attachment);  
You need to make following adjustments so that it fits your form:

1. Replace radiogroupname with the Name of the radio group element.

2. Replace groupvalue1 and groupvalue2 with values of A and B options in radio group.

3. Set the correct paths to the attachments a.jpg and b.jpg .

4. Replace 'wantedemail@mail.com' with the email address that you want to send the email to.

Let me know whether this works as you wanted.
If you have more questions, feel free to ask.

Regards,

Mihaela

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

conditional mailbackfile 3 years 1 month ago #230236

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

To send attachments in email depending on the radio group selection will require a custom solution since there isn't an option to simply set this.

Here is how to achieve what you want.

You have to go to Advanced options of your form > More options > Submit pieces and in the End Submit section, select Type Custom and there you have to create an email. Here is an example of the code that will do what you want:
$this->execPieceByName('ff_InitLib');
$from = 'your@email.com'; //change to wanted email
$fromname = 'yourname'; //change to wanted from name
$subject = 'Your Email Subject'; // Change to your preferred Email subject
$attachment = [];

$body = '';
foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'radiogroupname'){
   $ischeck =  $data[_FF_DATA_VALUE];
    if (strpos($ischeck, 'groupvalue1') !== false) {
        array_push($attachment , JPATH_SITE.'/media/breezingforms/pdftpl/a.pdf'); }
    if (strpos($ischeck, 'groupvalue2') !== false) {
        array_push($attachment , JPATH_SITE.'/media/breezingforms/pdftpl/b.pdf'); }
  }   

   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
 
}
$this->sendMail($from, $fromname, 'wantedemail@mail.com', $subject, $body, $attachment);  
You need to make following adjustments so that it fits your form:

1. Replace radiogroupname with the Name of the radio group element.

2. Replace groupvalue1 and groupvalue2 with values of A and B options in radio group.

3. Set the correct paths to the attachments a.jpg and b.jpg .

4. Replace 'wantedemail@mail.com' with the email address that you want to send the email to.

Let me know whether this works as you wanted.
If you have more questions, feel free to ask.

Regards,

Mihaela

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

conditional mailbackfile 3 years 1 month ago #230238

  • Topic Author
  • gcom
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 101
  • Thanks: 0
Hello Mihaela,
thank you very much. I'm glad, this is possible with Breezingforms.
Would this also be possible when I use a custom mailback template? The reason I'm asking for this is that I want to send this as an html formatted email to make it look prettier.
I tried to accomplish this by having the html code in the $body variable but it keeps sending the html code instead of sending html emails
Best Regards
Markus

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

Last edit: Post by gcom.

conditional mailbackfile 3 years 1 month ago #230240

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

You can add html code to body of the email in end submit, but you must add an additional $isHtml attribute to the sendmail function and set it to true in order for it to work.
I assume that you haven't set that and that is the reason it didn't work for you.
Here is an example of html email code from End Submit.
$this->execPieceByName('ff_InitLib');
$from = 'test@test.com';
$fromname =  'yourname';
$subject = 'mysubject';

$recipient = 'myemail@gmail.com'; 

$name= ff_getSubmit('name');
$email= ff_getSubmit('email');

$attachment=null;
$isHtml = true;

$body =  "
<html><body>

<h1>This is the title of email </h1>

<table style='color:blue;'>
<tr>
<td>
   <strong>Name:</strong>
</td>
<td>
   $name
</td>
</tr>

<tr>
<td>
   <strong>Email:</strong>
</td>
<td>
   $email
</td>
</tr>
</table>
</body></html>";

$this->sendMail($from, $fromname, $recipient, $subject, $body, $attachment, $isHtml); 

Let me know whether this solved the html code issue.
If you have more questions, feel free to ask.

Regards,

Mihaela

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

conditional mailbackfile 3 years 1 week ago #231040

  • zmand13
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
Hi,

I am not sure whether my question fits to this topic but it looks similar.
What I want to achieve is to create a Mailback email depending on the Value of the radiobuttons.
I tried to insert a simple php IF statement in the html code window of the mailback message but after saving the message the code was removed by the system.

My questions are:
1. can conditional mailback be done this way, by including php code in the html code window?
2. if yes, how this code should look like not to be removed by the system?
3. if not, how it can be done?

Thank you very much in advance.

Best,

Zoran

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

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.096 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

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!