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