php 3数组循环从第一个数组发送单个电子邮件

时间:2013-01-23 14:09:22

标签: php arrays email loops

我有三个阵列。它们都是基于索引的数组[0],[1] ......它们是:

$array_userinfo[login][email]
$array_userallmeetingfoldersco[login,folder-id]
$array_expiredmeetingscos[sco-id,folder-id,name,date-modified,date-end

$ array_userinfo的第一个元素(登录)匹配$ array_userallmeetingfoldersco的第一个元素(登录)。反过来,$ array_expiredmeetingssco的第二个元素(folder-id)。

我需要实现的是在$ array_userallmeetingfoldersco的'login'中找到IF array_userinfo的'login'然后在$ array_userallmeetingfoldersco和$ array_expiredmeetingscos之间找到任何匹配的'folder-id',如果找到,只发送一次''电子邮件'$ array_userinfo的地址;该电子邮件理想地包括来自$ array_expiredmeetingscos数组的'name','date-modified','date-end'字段。

更新:添加循环代码

foreach($array_userinfo as $userInfo) {//user logins; make this into easy to search
 $checkAgainstLogins[$userInfo[0]] = $userInfo[1];//0 is login, 1 is email
}

foreach($array_expiredmeetingscos as $expiredMeetings) {//expired meetings. make this into easy to search
$checkAgainstExpiredMeetings[$expiredMeetings[1]] = $expiredMeetings[2];//1 is folder-id, 2 is name
}

//loops for email follow
foreach($array_userallmeetingfoldersco as $matchingLogins) {
  if(isset($checkAgainstLogins[$matchingLogins])) {//login matched. Now find matching 'folder-id'
   foreach($array_expiredmeetingscos as $matchingFolderID) {
     if(isset($checkAgainstExpiredMeetings[$matchingFolderID])) {//folder-id matched
     //add to some array of expired Meetings? then email?
     }
   }
}

}

因此循环内循环,但复杂的因素是只发送一次电子邮件。要分享的任何代码? 谢谢!

0 个答案:

没有答案