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

how to generate csv file and send as attachment in cakephp

0 votes
76 views
asked in Web Development by anonymous
how to generate csv file and send as attachment in cakephp

1 Answer

0 votes
answered by Bhartesh (2,630 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,146 views
+5 votes
1 answer 1,137 views
+6 votes
3 answers 6,616 views
+2 votes
1 answer 118 views
+2 votes
3 answers 256 views
+2 votes
1 answer 120 views

Not a Member yet?

Answer Queue Login
131 Folks are online
0 members and 131 guest online