phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Procedural File: getmail.php

Source Location: /qp_srvc/getmail.php

Page Details

pop3-2-b2 mail to blog

modified for b2evolution 2.4.1 by Stephan Knauss. Contact me by PM in (user stephankn) or send a mail to stephankn at

Uses MIME E-mail message parser classes written by Manuel Lemos:

This script can be called with a parameter "test" to specify what should be done and what level of debug output to generate:

  • level 0: default. Process everything, no debug output, no html (called by cronjob)
  • level 1: Test only connection to server, do not process messages
  • level 2: additionally process messages, but do not post
  • level 3: do everything with extended verbosity
Only messages for "level 0" should get marked for translation (using T_()).

Quam Plures - Released under GNU GPL License -

Author:  tblue246: Tilman Blumenbach
Author:  Stephan Knauss
Copyright:  (c) 2009 - 2011 by the Quam Plures developers -
Copyright:  (c)2003-2009 by Francois PLANQUE - This file built upon code from original b2 -
Todo:  check different encodings. only tested with iso-8859-1
Todo:  try more exotic email clients like mobile phones
Todo:  Allow the user to choose whether to upload attachments to the blog media folder or to his user root.
Todo:  tested and working with thunderbird (text, html, signed), yahoo mail (text, html), outlook webmail, K800i
Filesource:  Source Code for this file
require_once ( [line 42]
[ Top ]

require_once (dirname(__FILE__).'/../qp_config/_config.php') [line 41]

load Quam Plures configuration

[ Top ]

ERROR  [line 85]

ERROR = 'red'

define colour constants for messages

[ Top ]

INFO  [line 82]

INFO = 'black'

define colour constants for messages

[ Top ]

SUCCESS  [line 83]

SUCCESS = 'green'

define colour constants for messages

[ Top ]

WARNING  [line 84]

WARNING = 'orange'

define colour constants for messages

[ Top ]

string   $content [line 77]

message content of current email that is going to be posted

Default value:  ''

[ Top ]

string   $post_date [line 70]

post date of current message

Default value:  ''

[ Top ]

string   $subject [line 63]

Subject of the current email message

Default value:  ''

[ Top ]

echo_message  [line 127]

void echo_message( string $strmessage, [string $color = ''], [integer $level = 0]  )

Print out a debugging message with optional HTML color added.

This function only outputs any additional HTML (colors,
) if $test is greater than 0.

string   $strmessage:  The message to print
string   $color:  optional colour so use
integer   $level:  optional level to limit output to that level

API Tags:
Global:  integer $test: The test level

[ Top ]
get_post_title  [line 396]

string get_post_title( string $content, string $alternate_title  )

look inside message to get title for posting.

The message could contain a xml-tag

  1. <title>sample title</title>
to specify a title for the posting. If not tag is found there could be a global $post_default_title containing a global default title. If none of these is found then the specified alternate title line is used.

string   $content:  message to search for title tag
string   $alternate_title:  use this string if no title tag is found

API Tags:
Return:  title of posting
See:  $post_default_title

[ Top ]
processAttachments  [line 311]

bool processAttachments( array $mailAttachments, string $mediadir, string $media_url, [bool $add_img_tags = true]  )

process attachments by saving into media directory and optionally creating image tag in post

array   $mailAttachments:  array containing path to attachment files
string   $mediadir:  path to media directory of blog as seen by file system
string   $media_url:  url to media directory as seen by user
bool   $add_img_tags:  should img tags be added (instead of adding a normal link)

API Tags:
Return:  true for sucessfull execution
Global:  bool 1: do we really post?
Global:  object global 2: QP settings
Global:  string $content$do_real_posting$Settings: message content that is optionally manipulated by adding image tags

[ Top ]
processHeader  [line 234]

bool processHeader( &$header, array $header  )

Process Header information like subject and date of a mail.

array   $header:  header as set by mime_parser_class::Analyze()

API Tags:
Return:  true if valid subject prefix is detected
Global:  integer 3: The test level (read)
Global:  string $subject: The subject of the current message (write)
Global:  string $post_date$Settings: The post date of the current message (write)
Global:  object QP $test: settings (read)

[ Top ]
sys_get_temp_dir  [line 164]

string sys_get_temp_dir( )

Provide sys_get_temp_dir for older versions of PHP (< 5.2.1).

code posted on by minghong at gmail dot com Based on

API Tags:
Return:  path to system temporary directory

[ Top ]
tempdir  [line 210]

string tempdir( string $dir, [string $prefix = 'tmp'], [integer $mode = 0700]  )

Create a new directory with unique name.

This creates a new directory below the given path with the given prefix and a random number.

string   $dir:  base path to new directory
string   $prefix:  prefix random number with this
integer   $mode:  permissions to use

API Tags:
Return:  path to created directory

[ Top ]