开发者

Email Array contents using email field in array

开发者 https://www.devze.com 2023-03-14 11:08 出处:网络
I have a 2D array such as the below: Array ( [0] => Array ( [asin] => B004HFS6Z0 [title] => Kindle, Wi-Fi, Graphite, 6\" Display with New E Ink Pearl Technology - includes Special Offers

I have a 2D array such as the below:

Array ( 
[0] => Array ( 
     [asin] => B004HFS6Z0 
     [title] => Kindle, Wi-Fi, Graphite, 6" Display with New E Ink Pearl Technology - includes Special Offers & Sponsored Screensavers 
     [price] => 114.00 
     [map] => 125.00 
     [email] => fake1@email.com ) 
[1] => Array ( 
     [asin] => B004CYX17O 
     [title] => Rizzy Home Apple 10-Piece Comforter Set, King 
     [price] => 502.80 
     [map] => 520.00 
     [email] => fake2@email.com ) ) 

What I want to do with it is export it into 2 csv files (could be more) based on the email field and then email the csv file as an attachment to the ema开发者_如何学Goil address in the field. There would be multiples with the email address that I would want to all be in the same csv file but when the email is different I would want that in a seperate csv file.

Is this possible? I am not sure where to begin with this but would really like some suggestions! Thanks in advance!


Yes its possible. Look at fopen, fputcsv and tempnam to write the csv data to a temp file.

The easiest way to send attachments is to use PEAR Mail library or Zend_Mail. You could write it yourself, but it does take a bit of work.

0

精彩评论

暂无评论...
验证码 换一张
取 消