TOPIC:

Multiple Attachment send by form 4 years 2 months ago #225911

  • Topic Author
  • guenni
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 97
  • Thanks: 1
How can I add selected multiple attachments to a form and send it to multiple adresses?

The attachements files which are placed on Server under ../exports/

See attachment for form view

Thanks for any Support.

Regards
Attachments:

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

Multiple Attachment send by form 4 years 2 months ago #225965

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

To send attachments depending on the checkboxes or send multiple-emails will requre 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 = [];

//$ischeck[]= ff_getSubmit('check');
$body = '';
 
$rec = ['0','0','0'];
foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'checkboxgroupname'){
   $ischeck =  $data[_FF_DATA_VALUE];
    if (strpos($ischeck, 'checkboxvalue1') !== false) {
        array_push($attachment , JPATH_SITE.'/media/breezingforms/pdftpl/attachemnt1.pdf'); }
    if (strpos($ischeck, 'checkboxvalue2') !== false) {
        array_push($attachment , JPATH_SITE.'/media/breezingforms/pdftpl/attachment2.pdf');  }
    if (strpos($ischeck, 'checkboxvalue3') !== false) {
        array_push($attachment , JPATH_SITE.'/media/breezingforms/pdftpl/attachment3.pdf');  }
  } 

  if( $data[_FF_DATA_NAME] == 'selectlistname'){
   $isselect =  $data[_FF_DATA_VALUE];
    if (strpos($isselect, 'selectvalue1') !== false) {
         $rec[0]= '1';   }
    if (strpos($isselect, 'selectvalue2') !== false) {
         $rec[1]= '1';   }
    if (strpos($isselect, 'selectvalue3') !== false) {
          $rec[2]= '1';   }
  } 

   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
 
}

if( $rec[0]=='1') {$this->sendMail($from, $fromname, 'mustermann@muster1.de', $subject, $body, $attachment); }
if( $rec[1]=='1') {$this->sendMail($from, $fromname, 'mustermann@muster2.de', $subject, $body, $attachment); }
if( $rec[2]=='1') {$this->sendMail($from, $fromname, 'mustermann@muster3.de', $subject, $body, $attachment); }

Here is what changes you need to make to the code other then the ones noted in the code:
1) Replace checkboxgroupname with the Name of the checkbox group where attachments are selected.
2) Replace checkboxvalue1, checkboxvalue2 and checkboxvalue3 with values of checkboxgroup options.

3) This is a code for attachments placed in They both are located in /media/breezingforms/pdftpl folder. Replace /media/breezingforms/pdftpl/attachemntnr.pdf with the correct path to the attachments, and adjust attachments names.

4) Replace selectlistname with the Name of the select list where emails are selected.

5) Replace selectvalue1, selectvalue2 and selectvalue3 with the values of that select list options.

6) In sendmail functions adjust the emails to the wanted ones if necessary.

The content of the emails you define in the $body.

I hope that this will help you. Let me know if you have managed to set this for your form.

If you have more questions, feel free to ask.

Regards,

Mihaela

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

Multiple Attachment send by form 4 years 2 months ago #226056

  • Topic Author
  • guenni
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 97
  • Thanks: 1
Great stuff - I will work it out.

Thanks

Günni

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

Multiple Attachment send by form 4 years 2 months ago #226121

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 416
Great!
Let me know if you managed to do it form your form.

Regards,

Mihaela

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

Multiple Attachment send by form 5 months 3 weeks ago #267733

  • michiel@TSS
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 225
  • Thanks: 1
Hi ,
I have a bit of simular form.
see screenshot, the difference is that i don't use a selectbox with emailadresses..
I tried to adjust the script given. But that doesn't work please help..
$this->execPieceByName('ff_InitLib');
$from = 'info@halaltime.eu'; //change to wanted email
$fromname = 'Halaltime'; //change to wanted from name
$subject = 'Restaurant informatie HalalTime'; // Change to your preferred Email subject
$attachment = [];

//$ischeck[]= ff_getSubmit('check');
$body = '';
 
$rec = ['0'];
foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'Bijlage'){
   $ischeck =  $data[_FF_DATA_VALUE];
    if (strpos($ischeck, 'value1') !== false) {
        array_push($attachment , JPATH_SITE.'/images/systeem/HT_Inschrijfformulier.pdf'); }
    if (strpos($ischeck, 'value2') !== false) {
        array_push($attachment , JPATH_SITE.'/images/systeem/Informatiebrochure_HalalTime.pdf');  }
    } 

$data[_FF_DATA_NAME] == 'mailadres';

$body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
 
}
Want to be able to fill in an email adress and then select 1 or 2 different pdfs to mail back..
see attachement..
Hope you can help.
Attachments:

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

Multiple Attachment send by form 5 months 3 weeks ago #267735

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10566
  • Karma: 3
  • Thanks: 705
Hi again,

like this:
$this->execPieceByName('ff_InitLib');
$from = 'info@halaltime.eu'; //change to wanted email
$fromname = 'Halaltime'; //change to wanted from name
$subject = 'Restaurant informatie HalalTime'; // Change to your preferred Email subject
$attachment = [];
$recipient=ff_getSubmit('nameofemailelment');

//$ischeck[]= ff_getSubmit('check');
$body = '';
 
foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'Bijlage'){
   $ischeck =  $data[_FF_DATA_VALUE];
    if (strpos($ischeck, 'value1') !== false) {
        array_push($attachment , JPATH_SITE.'/images/systeem/HT_Inschrijfformulier.pdf'); }
    if (strpos($ischeck, 'value2') !== false) {
        array_push($attachment , JPATH_SITE.'/images/systeem/Informatiebrochure_HalalTime.pdf');  }
    } 
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
}

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

Let me know the result

P.S: please replace nameofemailelement with name for your email element (not title)

Regards,
Tihana

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

Last edit: Post by tihana.krivic.
Moderators: ForumSupport
Time to create page: 0.094 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!