function mailhandler_authenticate_default in Mailhandler 7
Same name and namespace in other branches
- 6 mailhandler.module \mailhandler_authenticate_default()
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.
Parameters
$node: Object a node object
$header: Object of message header information
$origbody: String message body text
$mailbox: Array of mailbox configuration
Return value
object, the node object
1 string reference to 'mailhandler_authenticate_default'
- mailhandler_mailhandler_authenticate_info in ./
mailhandler.module - Implementation of hook_mailhandler_authenticate_info()
File
- ./
mailhandler.module, line 663
Code
function mailhandler_authenticate_default($node, $header, $origbody, $mailbox) {
list($fromaddress, $fromname) = mailhandler_get_fromaddress($header, $mailbox);
if ($from_user = mailhandler_user_load($fromaddress, $node->pass, $mailbox)) {
$node->uid = $from_user->uid;
$node->name = $from_user->name;
}
else {
if (function_exists('mailalias_user') && ($from_user = mailhandler_user_load_alias($fromaddress, $node, $mailbox))) {
$node->uid = $from_user->uid;
$node->name = $from_user->name;
}
else {
// Authentication failed. Try as anonymous.
$node->uid = 0;
$node->name = $fromname;
}
}
return $node;
}