Hey there! any question in your mind? Ask It Now!.

Popular Categories





how to generate csv file and send as attachment in cakephp

0 votes
160 views
asked in Programming by anonymous
how to generate csv file and send as attachment in cakephp

1 Answer

0 votes
answered by Bhartesh (2,610 points)
edited by Bhartesh

To generate csv file you can check this question (Already answered) : 

How to generate CSV file in cake php?

And to send it on attachment this code can help you, pls check :
 
$email = new PHPMailer(); 
$email->From = 'you@example.com'; 
$email->FromName = 'Your Name';
 $email->Subject = 'Message Subject'; 
$email->Body = $bodytext;
 $email->AddAddress( 'destinationaddress@example.com' ); 
$file_to_attach = 'PATH_OF_YOUR_FILE_HERE';
 $email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' ); 
return $email->Send();

Related Questions

+6 votes
2 answers 1,189 views
+5 votes
1 answer 1,153 views
+6 votes
3 answers 6,759 views
+2 votes
1 answer 121 views
+2 votes
3 answers 261 views
+2 votes
1 answer 125 views

Not a Member yet?

Ask to Folks Login

My Account
206 Folks are online
0 members and 206 guest online
Your feedback is highly appreciated