[TYPO3-english] mail2ttnews and external cron service

Loek Hilgersom loek at netcoop.nl
Thu Feb 7 10:50:17 CET 2013


Hi,

You cannot run getmail_cli without cli_dispatch because mail2news needs some 
parts of TYPO3 initialized to be able to work.

What you can do is either make create a FE-plugin that will call the parts that 
do the mail import, or you have to modify the init.php inside mail2news to 
initialize the necessary parts of the TYPO3 framework.

mail2news did that a long time ago, before the cli_dispatcher was introduced 
(somewhere around TYPO3 v4.2 I think). You should be able to put this back in, 
although this code is really old so you may have to change a thing or two:

Edit init.php and comment out the part that says
// Stop script if someone tries to access it through HTTP

Below is the old version of init.php, if you add the parts that are not in the 
current version, then it may just work but it may take a bit of effort.

Loek


<?php

	// Stop script if someone tries to access it through HTTP
	if(isset($_SERVER)) {
		$GLOBALS['__SERVER']	=&$_SERVER;
	} elseif(isset($HTTP_SERVER_VARS)) {
		$GLOBALS['__SERVER']	=&$HTTP_SERVER_VARS;
	}
	if (isset($GLOBALS['__SERVER']['HTTP_HOST'])) die(date("Y-m-d H:i:s ") . 
'Unallowed script access (HTTP request)');

	define("PATH_typo3conf", dirname(dirname(dirname(__FILE__)))."/");
	define("PATH_site", dirname(PATH_typo3conf)."/");
	define("PATH_typo3", PATH_site."typo3/");       // Typo-configuraton path
	define("PATH_t3lib", PATH_site."t3lib/");
	define("PATH_uploads_pics", PATH_site."uploads/pics/");
	define('TYPO3_MODE','BE');
	ini_set('error_reporting', E_ALL ^ E_NOTICE);
	//ini_set('max_execution_time',0);
	define('TYPO3_cliMode', TRUE);

	// Read TYPO3 configuration
	require_once (PATH_typo3conf.'localconf.php');

	require_once (PATH_t3lib.'class.t3lib_tcemain.php');
	require_once (PATH_t3lib.'class.t3lib_div.php');
	require_once (PATH_t3lib.'class.t3lib_extmgm.php');
	require_once (PATH_t3lib.'config_default.php');

	// Connect to TYPO3 database
	if (!defined ("TYPO3_db")) die ("The configuration file was not included.");
	require_once(PATH_t3lib.'class.t3lib_db.php');          // The database library
	$TYPO3_DB = t3lib_div::makeInstance('t3lib_db');
	$TYPO3_DB->sql_pconnect (TYPO3_db_host, TYPO3_db_username, TYPO3_db_password);
	$TYPO3_DB->sql_select_db (TYPO3_db);
	
	// Store configuration settings from EM in array $extConf
	$extConf = unserialize($TYPO3_CONF_VARS['EXT']['extConf']['mail2news']);

?>


On 05-02-13 14:43, Jeppe Donslund wrote:
> Hi
>
> My web host doesn't provide cron jobs. But there are a lot of external services
> providing cron jobs.
>
> But what address should I use for importing emails to tt_news?
>
> I have installed and configured mail2ttnews, but in the documentation it says
> that I should use this:
>
> 10 * * * * /path/typo3/cli_dispatch.phpsh getmail_cli >>
> /path/fileadmin/cron.log 2>&1
>
> That won't work. Isn't there a normal url I can use for the cron jobs?
>
> I know that **** should be replaced with the website address.
>
>
> Regards
> Jeppe Donslund


More information about the TYPO3-english mailing list