home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (mimemail.incoming.inc)

This example Drupal source code file (mimemail.incoming.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

2010/10/30, denied, file, foreach, function, hash, if, mail, message, mimemail_incoming, module, php, return, token

The mimemail.incoming.inc Drupal example source code

<?php /* $Id: mimemail.incoming.inc,v 1.1.2.3 2010/10/30 18:00:24 sgabe Exp $ */

/**
 * @file
 * Functions that handle inbound messages to mimemail.
 */

/**
 * Receive messages POSTed from an external source.
 *
 * This function enables messages to be sent via POST or some other RFC822
 * source input (e.g. directly from a mail server).
 *
 * @return
 *   The POSTed message.
 */
function mimemail_post() {
  $message = $_POST['message'];
  $token   = $_POST['token'];
  $hash    = md5(variable_get('mimemail_key', '**') . $message );

  if ($hash != $token) {
    watchdog('access denied', 'Authentication error for POST e-mail', WATCHDOG_WARNING);
    return drupal_access_denied();
  }
  return mimemail_incoming($message);
}

/**
 * Parses an externally received message.
 *
 * @param $message
 *   The message to parse.
 */
function mimemail_incoming($message) {
  require_once dirname(__FILE__) .'/mimemail.inc';
  $mail = mimemail_parse($message);

  foreach (module_implements('mimemail_incoming_alter') as $module) {
    call_user_func_array($module .'_mimemail_incoming_alter', $mail);
  }

  module_invoke_all('mimemail_incoming', $mail);
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal mimemail.incoming.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.