Form Help

TOPIC:

Attach 2 uploads 3 weeks 1 day ago #250271

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

please try this:
$this->execPieceByName('ff_InitLib');
$subject = 'APPLICATION FOR UTILITY PERMIT'; // Change to your preferred Email subject
$recipient = 'me@myemail.com'; // Change to your admin Email address



$attachment = null;
$isHtml = true;

$body = " ";

 if (count($this->maildata)){
          foreach ($this->maildata as $data){
          
                $testEx = explode("\n", trim($data[_FF_DATA_VALUE]));
                $cntTestEx = count($testEx);
                if($cntTestEx > 1){
                      for($ex = 0; $ex < $cntTestEx; $ex++){
                            if(!is_array($attachment) && $attachment != ''){
                                    $attachment = array_merge(array(trim($testEx[$ex])), array($attachment));
                            }                            
                            else if(is_array($attachment)){
                                    $attachment = array_merge(array(trim($testEx[$ex])), $attachment);
                            }                            
                            else{
                                    $attachment = trim($testEx[$ex]);
                            }
                      }
                }                
                else{
                      if(!is_array($attachment) && $attachment != ''){
                             $attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), array($attachment));
                      }                      
                      else if(is_array($attachment)){
                             $attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), $attachment);
                      }
                      else {
                             $attachment = trim($data[_FF_DATA_VALUE]);
                      }
                }
 
           }
     } 
 
foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'upload' )
{
   $body .= $data[_FF_DATA_TITLE].': http://myurlcom.com/public_html/media/breezingforms/uploads/' . basename($data[_FF_DATA_VALUE]);
} else {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
 
  }
}

foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'upload1' )
{
   $body .= $data[_FF_DATA_TITLE].': http://myurl.com/public_html/media/breezingforms/uploads/' . basename($data[_FF_DATA_VALUE]);
} else {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
 
  }
}
 
$this->sendMail($from, $fromname, $recipient, $subject, $body, $attachment, $isHtml);  // This line actually emails

Regards,
Tihana

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

Attach 2 uploads 3 weeks 23 hours ago #250288

  • Topic Author
  • paul1234ohio
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
That also duplicates the submitted form information.

I'm looking to to format the emailed form as the attached image shows, with the signature embedded, but have the two uploaded files attached.

Thanks again.
Attachments:

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

Attach 2 uploads 3 weeks 16 hours ago #250292

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

okay, I understand why the form information was duplicated ($body is called twice).
So, please try this:
$this->execPieceByName('ff_InitLib');
$subject = 'APPLICATION FOR UTILITY PERMIT'; // Change to your preferred Email subject
$recipient = 'me@myemail.com'; // Change to your admin Email address



$attachment = null;
$isHtml = true;

$body = " ";

 if (count($this->maildata)){
          foreach ($this->maildata as $data){
          
                $testEx = explode("\n", trim($data[_FF_DATA_VALUE]));
                $cntTestEx = count($testEx);
                if($cntTestEx > 1){
                      for($ex = 0; $ex < $cntTestEx; $ex++){
                            if(!is_array($attachment) && $attachment != ''){
                                    $attachment = array_merge(array(trim($testEx[$ex])), array($attachment));
                            }                            
                            else if(is_array($attachment)){
                                    $attachment = array_merge(array(trim($testEx[$ex])), $attachment);
                            }                            
                            else{
                                    $attachment = trim($testEx[$ex]);
                            }
                      }
                }                
                else{
                      if(!is_array($attachment) && $attachment != ''){
                             $attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), array($attachment));
                      }                      
                      else if(is_array($attachment)){
                             $attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), $attachment);
                      }
                      else {
                             $attachment = trim($data[_FF_DATA_VALUE]);
                      }
                }
 
           }
     } 
 
foreach ($this->maildata as $data) {
 
  if( $data[_FF_DATA_NAME] == 'upload' &&  $data[_FF_DATA_NAME] == 'upload1')
{
   $body .= $data[_FF_DATA_TITLE].': http://myurlcom.com/public_html/media/breezingforms/uploads/' . basename($data[_FF_DATA_VALUE]);
} else {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
 
  }
}


 
$this->sendMail($from, $fromname, $recipient, $subject, $body, $attachment, $isHtml);  // This line actually emails

Regards,
Tihana

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

Attach 2 uploads 1 week 21 hours ago #250848

  • Topic Author
  • paul1234ohio
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
That puts the submitted information at the bottom of the submitted form. I just want the form to be formatted so the signature is embedded and add the two attachments. So like the photo that I'm posting plus the two attachment but with no other fields from the form included.

Thanks.
Attachments:

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

Attach 2 uploads 1 week 16 hours ago #250852

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

give me some time to test this

EDIT:
ok, then you can create body like this (this is my example, please customize it to yourself)->I shown name, email, signature, and 2 upload file as attachemnt
$this->execPieceByName('ff_InitLib');
$subject = 'APPLICATION FOR UTILITY PERMIT'; // Change to your preferred Email subject
$recipient = 'tihana.krivic@crosstec.org'; // Change to your admin Email address
//grab values from fields that you want to pass in Admin email, replace Signatur and name with names of elements in your form
$signature= ff_getSubmit('sign');  //change it to your fields which you want to show
$text=ff_getSubmit('text1');
$email=ff_getSubmit('email');


$attachment = null;
$isHtml = true;



 if (count($this->maildata)){
          foreach ($this->maildata as $data){
          
                $testEx = explode("\n", trim($data[_FF_DATA_VALUE]));
                $cntTestEx = count($testEx);
                if($cntTestEx > 1){
                      for($ex = 0; $ex < $cntTestEx; $ex++){
                            if(!is_array($attachment) && $attachment != ''){
                                    $attachment = array_merge(array(trim($testEx[$ex])), array($attachment));
                            }                            
                            else if(is_array($attachment)){
                                    $attachment = array_merge(array(trim($testEx[$ex])), $attachment);
                            }                            
                            else{
                                    $attachment = trim($testEx[$ex]);
                            }
                      }
                }                
                else{
                      if(!is_array($attachment) && $attachment != ''){
                             $attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), array($attachment));
                      }                      
                      else if(is_array($attachment)){
                             $attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), $attachment);
                      }
                      else {
                             $attachment = trim($data[_FF_DATA_VALUE]);
                      }
                }
 
           }
     } 

$body =  "
<html><body>
<h1>APPLICATION FOR UTILITY PERMIT </h1>
<table>
<tr>
<td>
   <strong>Name:</strong>
</td>
<td>
    $text
</td>
</tr>

<tr>
<td>
<strong>Email:</strong>
</td>
<td>
$email
</td>
</tr>

<tr>
<td>
   <img src= 'https://YOURDOMAIN.com/media/breezingforms/signatures/'.$signature width='150' height='150'>
</td>
</tr>
</table>
</body></html>";
 



 
$this->sendMail($from, $fromname, $recipient, $subject, $body, $attachment, $isHtml);  // This line actually emails

Please replace 'yourdomain.com' with yours

Regards,
Tihana

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

Last edit: Post by tihana.krivic.
  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.073 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!