function MailhandlerCommandsHeaders::process in Mailhandler 6.2
Same name and namespace in other branches
- 7.2 plugins/mailhandler/commands/MailhandlerCommandsHeaders.class.php \MailhandlerCommandsHeaders::process()
Set known sources and parse additional sources from body.
Overrides MailhandlerCommands::process
File
- plugins/
mailhandler/ commands/ MailhandlerCommandsHeaders.class.php, line 12 - MailhandlerCommandsHeaders class.
Class
- MailhandlerCommandsHeaders
- @file MailhandlerCommandsHeaders class.
Code
function process(&$message, $source) {
// Populate $message with all values from 'header' object.
$parts = (array) $message['header'];
foreach ($parts as $key => $value) {
// Some keys are already taken, so do not overwrite them.
if (!in_array($key, array(
'header',
'body_text',
'body_html',
'mimeparts',
'mailbox',
'attachments',
))) {
// Some headers are arrays of objects
if (in_array($key, array(
'to',
'from',
'reply_to',
'sender',
'cc',
'bcc',
'return_path',
))) {
$message[$key . '-name'] = isset($value[0]->personal) ? iconv_mime_decode($value[0]->personal, 0, "UTF-8") : '';
$message[$key . '-address'] = isset($value[0]->mailbox) && isset($value[0]->host) ? $value[0]->mailbox . '@' . $value[0]->host : '';
}
else {
$message[$key] = iconv_mime_decode($value, 0, "UTF-8");
}
}
}
}