Hey,
I have another thread that this option can solve.... if I can attach a file uploaded through Formbuilder with a UDT and send it via CMSMailer. Note, files are being uploaded.
Note: 'Deny file to be attached with emails', is unticked.
Can anyone see a problem in my UDT with the file upload/attachment:
$actparams = $smarty->get_template_vars('actionparams');
$form_id = $actparams['form_id'];
if($form_id == 5) {
$mail = cms_utils::get_module('CMSMailer');
{* -- my file upload is {$attachcv} / {$fld_53} -- *}
if(!empty($params['fld_53'])) {
$fileupload = $params['fld_53'];
} else {
$fileupload = '';
}
$subject = " here ";
$body = " body of email ";
$mail->AddAddress( $destination );
$mail->IsHTML( true );
$mail->SetBody( $body );
$mail->SetSubject( $subject );
$mail->AddAttachment('$fileupload', 'PDF file', 'base64', 'application/pdf');
$mail->Send();
$mail->reset();
}
Also see http://forum.cmsmadesimple.org/viewtopi ... =8&t=67308
UDT, attach formbuilder file upload to email
Re: UDT, attach formbuilder file upload to email
Also a file is attached to emails when using a non UDT submission e.g.
'Email Results to set Address(es)'.
'Email Results to set Address(es)'.
Re: UDT, attach formbuilder file upload to email
I've tried the following:
//Attach an image file
//$mail->AddAttachment($file);
//$mail->AddAttachment($_fileupload['file']['tmp_name'], $_fileupload['file']['name']);
//$mail->AddAttachment("/uploads/cvs/$fileupload");
$mail->AddAttachment($path/$fileupload, 'PDF file', 'base64', 'application/pdf' );
//Attach an image file
//$mail->AddAttachment($file);
//$mail->AddAttachment($_fileupload['file']['tmp_name'], $_fileupload['file']['name']);
//$mail->AddAttachment("/uploads/cvs/$fileupload");
$mail->AddAttachment($path/$fileupload, 'PDF file', 'base64', 'application/pdf' );
Re: UDT, attach formbuilder file upload to email
Okay, getting there 
This works. But my emailed PDFs are corruptly encoded.. they won't load
.
$remote_path = 'http://www.domain.com/$fileupload';
$mail->AddStringAttachment($remote_path, $fileupload, $encoding = 'base64', $type = 'application/octet-stream');

This works. But my emailed PDFs are corruptly encoded.. they won't load

$remote_path = 'http://www.domain.com/$fileupload';
$mail->AddStringAttachment($remote_path, $fileupload, $encoding = 'base64', $type = 'application/octet-stream');
- PinkElephant
- Forum Members
- Posts: 173
- Joined: Fri Feb 06, 2009 2:08 pm
Re: UDT, attach formbuilder file upload to email
Looks like quoting the $fileupload variable passes '$fileupload' rather than the intended value.KayakMan wrote: $mail->AddAttachment('$fileupload', 'PDF file', 'base64', 'application/pdf');
(The docs suggest the AddAttachment method returns a boolean for success/failure so an if() might help deal with a bad path, etc).