2011年4月27日星期三

搭建邮件服务器 自动收发邮件做处理

系统:Centos
     install  fetchmail and procmail



<a href="mailto:registerboschpt@gmail.com?subject=register_12345hh55xx&body=12345hh55xx">Submit Email</a>
fetchmail -> procmail -> registration_script -> sendmail (for welcome mail)
There's an option. "set daemon 60"
In the fetchmail config, you set the mda as procmail. For example:
 poll imap.gmail.com protocol IMAP user "henri@mobalean.com" there with password "xx" keep ssl mda "/usr/bin/procmail -m /home/henri/procmail-mobalean.conf"


user_info
  userID
  userIndustry
  userAddress
  userGender
  date_time 

user_email
  userID
  userEmail




  • http://www.webmasterworld.com/webmaster/3359450.htm




  • http://ask.metafilter.com/25271/Advanced-parsing-with-procmail



  • 今天我说一下,我是如何配置fetchmail 来收取gmail 邮件的。
    首先,我花了几天的时间看了fetchmail 和procmail 等这些东西在/usr/share/doc 下的文档。同时大概看了一下fetchmail 的手册页。
    配置如下,参考了example 文件:
    # ~/.fetchmailrc for user-specific
    # This file MUST be chmod 0600, owner fetchmail

    # The default for this option is 300, which polls the server every 5 minutes.
    #
    # set daemon    1200
    #
    # By default, the fetchmail will output logging messages to
    # syslog; uncomment the line below to disable this. This might be useful
    # if you are logging to another file using the 'logfile' option.
    #
    # set no syslog
    #
    # Avoid loss on 4xx errors. On the other hand, 5xx errors get more
    # dangerous.
    #
     set no bouncemail
    #
    # Set postmaster to nico, so that I can receive mail under any conditions
    # Even if destination of undeliverable mail or no matching local recipient
    # mails
    #
     set postmaster nico
    #
    # The following defaults are used when connecting to any server, and can
    # be overridden in the server description below.
    #
    # Set antispam to -1, since it is far safer to use that together with no
    # bouncemail.
    #
    #
    defaults
        protocol pop3
        mda "formail -s procmail"
        antispam -1
        ssl sslcertck keep
            sslcertpath '/etc/ssl/certs/'
    poll pop.gmail.com with uidl
           user 'mygmailaccount@gmail.com' there with password 'mypassword' is 'nico' here

    说明:
    1.文字中的反斜杠请在复制后手工删除,这是博客系统的问题。为防止安全问题,它自动对引号进行了转义。

    按照fetchmail 手册页中的说法(我英文不是太好)
    2. set ... 开头的是全局参数,如 bouncemail、postmaster等。这里我设置了postmaster 为nico 
       ,这是我的Debian 系统上的一个用户名,请换成你自己的用户名。这样我就可以收到一些发信地址不可
       到达或者是本地没有相关匹配收件人的邮件。
    3. 关键词defaults 等同于poll ,因此在defaults 后面跟着的第一行一定要是邮件服务器用的参数,如
       protocol、uidl、dns、no dns等。
    4. 下面的poll 用来具体指定一个邮件服务器,完全可以把上面defaults 字段中的参数放到这里。但要小
       心,千万不要把服务器参数和用户参数混淆了。
    5. defaults 字段中的protocol 是服务器参数,antispam、ssl、keep 是用户参数。mda 建议放在  
       defaults 字段。其它的关键词只要不跟在服务器或者用户帐号的后面,放哪里都行。
    6. mda "formail -s procmail"来自于man procmail。请改成你自己的MDA客户端程序,并做相应配
       置。fetchmail 的手册页里不推荐procmail ,它推荐maildrop 作为客户端。但我用着没问题。个
       人看着办吧。想要这方面的详细信息,请man fetchmail
    7. sslcertpath 中的内容请改成自己系统中的路径。如果没有请参照网上的方法做一下签名文件放好。
    7. 暑假我会找时间翻译fetchmail、procmail、msmtp 的手册页的。

    没有评论:

    发表评论

    上海松善实业有限公司

        上海松善实业有限公司是一家集多品牌销售于一体的电线电缆骨干企业,公司成立于2016年。 公司拥有国内各大品牌:起帆、远东、上上、江南、胜华等。     主要产品有:高低压电力电缆、橡套电缆、控制电缆、架空绝缘电缆、塑胶电缆、电子计算机电缆、通讯电缆、...