Here is the contents of $result array:
Array (
[ts] => (somenumber)
[_id] => (theid)
[state] => sent
[subject] => Test message
[email] => (some email)
[tags] => Array ( )
[opens] => 0
[clicks] => 0
[smtp_events] => Array ( )
[resends] => Array ( )
[sender] => (some email)
[template] => (some template)
[opens_detail] => Array ( )
[clicks_detail] => Array ( )
)
I want to access [state] => sent so that I can print the status, which is whether an email has been sent or not. Below is my code where I try to retrieve it with a foreach loop:
$result = $GLOBALS['mandrill']->messages->info($id);
// Get the status of the email
foreach ($result as $key => $message) {
$status = $message['state'];
}
I get the error Notice: Undefined index: state.
What am I doing wrong?