Software‎ > ‎

twitter_mailgateway.py

This script work as mail gateway for Twitter. It receives a mail, then it gets timeline and reply with it.  If there is some status to update, post it before getting timeline.
I think this script works even for regular e-mail, but I developed this for especially mobile phone mail.  So there may be some problems.

Requirement

This script works with twitter.py. So please download it before.

How to set up

  1. Put this script in the same directory where twitter.py is.
    e.g.
    /home/mits/python/twitter_mailgateway.py
  2. Configure some statement of this script.
    1. Variable "codec" in 67th line
      This value will be used to encode a message to send.
      e.g. codec = 'utf-8'
    2. Variable "faddr" in 68th line
      This value will be used for mail header to send timeline as response.  So make sure that this address is available one.
      e.g. faddr = 'tw@example.com'
  3. Configure aliases of MTA (like Postfix, sendmail, etc,.).
    Configure the file for aliases to make a address for this script.  If your domain is "example.com" and you want to receive mails at "tw@example.com", write below in "/etc/aliases" or some file like that.
    e.g. tw: "| /home/mits/python/twitter_mailgateway.py"
  4. Update the information of alias.
    Run the command "newaliases" by root.

How to use

Given that the address for is "tw@example.com".
  • Public timeline:
    If users send mail to "tw@example.com" whose bodies are null or contains only one line, the mail with public timeline will be returned.
  • Friends' timeline:
    If users send mail to "tw@example.com" whose bodies are username for twitter at first line and password for twitter at second line, the mail with friends' timeline will be returned.
  • Update status:
    If users send mail to "tw@example.com" whose bodies are username for twitter at first line, password for twitter at second line and more lines for status, the status at twitter will be updated, then the mail with friends' timeline will be returned.

Guarantee and Rights

I developed this script for my ownself, so I guarantee nothing with using this script.
I maintain no rights about this script.
Č
ċ
ď
twitter_mailgateway.py
(2k)
Mitsuhiro SETOGUCHI,
2008/12/07 8:31

ナビゲーション

最近の更新履歴