#!/usr/bin/php */ include 'twitteraccount.php'; include 'incomingemailparser.php'; // This list is to make sure, that only correct email senders can access this script. $aAccessList = array( // This is the default tweetlater sender info, that should not be changed 'TweetLater Service ', // Add test address, if you want to send test email to this script ie. email account #'Test Address ', ); // You should use twittername on your email like: mytwittername@domain.com because it makes possible to handle // multiple twitter accounts without hassle. If you cannot user twitter name on your email check instructions below. $aAccounts = array( // Change both Twitter name and password to real one. 'mytwittername' => 'password', // Add more accounts here. #'mytwittername2' => 'password', ); $iep = new IncomingEmailParser(); preg_match("/([0-9a-zA-Z_]*)@/", $iep->aEmailInfo['to'], $matches); // If you cannot use twitter name on email address, other option is to assign username and password here #$twitter_username = 'mytwittername'; #$twitter_password = 'password'; $twitter_username = trim($matches[1]); $twitter_password = $aAccounts[$twitter_username]; if ($iep->is_valid_access($aAccessList)) { include 'twitter-functions.php'; $sText = kw_alert_follow($iep->aEmailInfo['message'], $twitter_username, $twitter_password); } else { $sText = 'Unvalid access to '.__FILE__.' file! '."\r\n\r\n".implode("\r\n\r\n\r\n", $iep->aEmailInfo); } // Uncomment this function to email file access debug text. #mail('admin@domain.com', 'Access '.__FILE__, $sText); exit(); ?>