+
+ // try to find which identity the mail should come from
+ include_once(SM_PATH . 'functions/identity.php');
+ $idents = get_identities();
+ // ripped from src/compose.php
+ $identities = array();
+ if (count($idents) > 1) {
+ foreach($idents as $nr=>$data) {
+ $enc_from_name = '"'.$data['full_name'].'" <'. $data['email_address'].'>';
+ $identities[] = $enc_from_name;
+ }
+
+ $identity_match = $message->rfc822_header->findAddress($identities);
+ if ($identity_match !== FALSE) {
+ $identity = $identity_match;
+ }
+ }