+ // fetch the subject for the message with $id from msgs.
+ // is there a more efficient way to do this?
+ foreach($msgs as $k => $vals) {
+ if($vals['ID'] == $id) {
+ $subject = $msgs[$k]['SUBJECT'];
+ break;
+ }
+ }
+
+ array_shift($body_a);
+ $body = implode('', $body_a);
+ $body .= "\r\n";