Download mail2twitter
Version 1.0

mail2twitter is a PHP-Script that allows you to write a twitter message just with sending a email. It includes a password function so that you can protect your twitter-account against spam messages. I wrote this little script because I love to tweet in twitter by Tweetie on my iPhone. But if I found an interesting website or URL on my iPhone there isn’t any possibility to post it on twitter cause of the absence of the copy&paste function :-( To come out of this dilemma I coded this little script that allows me easily to post a YouTube-link or a website on my twitter blog.


You need your own server with a writeable access to the crontab and PHP including the curl-module on it. (Alternative to the crontab access you can use the service on http://www.cron-job.org;))


mail2twitter includes the following features:

  • it automatically checks a POP3 or IMAP Server for new messages and sends them to twitter by the twitter-API.
  • only emails with a predefined string in it would be posted on twitter -> password protection


// === CONFIGURATION ========================================================================
      $config[pop3_server] = "imap.server.de";      // POP3/IMAP Server
      $config[pop3_user] = "dennis";                // POP3/IMAP User
      $config[pop3_password] = "password";          // POP3/IMAP Password
      $config[m2t_password] = "";                   // Password transmitted in email body
      $config[twitter_user] = "jakezz";	            // twitter username
      $config[twitter_password] = "password";       // twitter password
// === CONFIGURATION END ====================================================================

I think everything except the $config[m2t_password] string in line 6 should be clear. With this String it is possible to insert a little password function into the m2t Script. You could leave it blank to disable the password-verify-process. After setting up the script you must insert a line like this

*/5    *    *    *    *    php /srv/www/htdocs/service/mail2twitter/m2t.php

in your crontab to execute the m2t-script every 5 minutes. Thats it! Now you can easily use the safari  “Mail Link to this Page”-function and the YouTube-mail-button to post the content on your twitter blog :-)