You are here

function mailhandler_get_fromaddress in Mailhandler 6

Same name and namespace in other branches
  1. 5 mailhandler.module \mailhandler_get_fromaddress()
  2. 7 mailhandler.module \mailhandler_get_fromaddress()

Determine from address either using the mailbox setting or via the header information

Parameters

$header: Object message header information

$mailbox: Array mailbox settings

Return value

array

4 calls to mailhandler_get_fromaddress()
mailhandler_authenticate_default in ./mailhandler.module
Authenticate message based on sender's email address If the sender's email address matches an email address of a valid user, then assign that user's uid and name to the node object.
mailhandler_authenticate_tokenauth in ./mailhandler.module
Authenticate message based on token from tokenauth module If the user's token is found somewhere in the "to" field, assign that user's uid and name to the node object. A rough search for the token somewhere in the…
mailhandler_comment_submit in ./mailhandler.module
Create the comment.
mailhandler_node_submit in ./mailhandler.module
Create the node.

File

./mailhandler.module, line 1240
Mailhandler module code.

Code

function mailhandler_get_fromaddress($header, $mailbox) {
  if (($fromheader = strtolower($mailbox['fromheader'])) && isset($header->{$fromheader})) {
    $from = $header->{$fromheader};
  }
  else {
    $from = $header->from;
  }
  return array(
    $from[0]->mailbox . '@' . $from[0]->host,
    isset($from[0]->personal) ? $from[0]->personal : '',
  );
}