PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

How to attach the PHPExcel output as PHPMailerAttachment #1397

Closed JoysonAnto closed 6 years ago

JoysonAnto commented 6 years ago

i have tried these but not resolved $excelstring = $objWriter->save('//php://output'); $mail->AddAttachment($excelstring, 'myfile.xls');

itsdanielfelix commented 6 years ago

try this,

$excelstring = $objWriter->save(sys_get_temp_dir() . '/myfile.xls'); $mail->AddAttachment(sys_get_temp_dir() . '/myfile.xls', 'myfile.xls');

you can also use any other directory instead of the temp directory