POP Post

What is

POPPost is a module for Drupal that watches a POP3 mailbox and creates nodes from incoming emails.

How it works

Mail reading is scheduled by cron. Every time it runs:

  • connects to the mailbox and download new mails
  • parse mails using mimemail to extract content: headers, parts, attachments, …
  • saves the content of the mail in a table (useful for debugging, but can be avoided in future)
  • if the mail matches some conditions, create a node
  • mark the mail as processed in the inbox table by adding the nid of the created node (debug)

Format of the mail

The mails are created in as follows:

Subject:

[NODE:nodetype] title of the node

Body (the 'text' in multipart mails):

this text will be ignored

-----BEGIN DRUPAL NODE-----
Param1: value1
Param2: value2

the content of the node
-----END DRUPAL NODE-----

--
this signature is ignored

This will create a node of type nodetype, titled "title of the node" and with content "the content of the node".

Parameters Param1 and Param2 are added to the node in a way like:

$node->Param1="value1"
$node->Param2="value2"

..this is useful when creating nodes with more fields than just title and body.

Authentication

Of course, we need an authentication mechanism more sofisticated than just checking the sender of the email, because the From: field is easily spoofable. At the moment, we use the email address to determine the uid of the author, and a per-user control code that must be present in the message to check the autenticity of the message. In the future, it will be cool to use another authentication method, such as GPG signature control..

Attachments

..and, of course, I'm planning to process also attachments to the mail and add them as attachments to the created node.

 
Translations of this page:
projects/drupal/poppost.txt · Last modified: 2008/11/30 18:12 by redshadow
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki