zoukankan      html  css  js  c++  java
  • 打造你的办公环境-email篇

    1. 配置安装 procmailr 和 getmail

    ///////////////////////////////// ignore the follow  /////////////////////////////////////////

    $ mkdir mail-setup

    $ cd mail-setup/

    $ tar xpfv muttrc-out-of-box.tgz

    $ cd .mutt/

    $ rm muttrc-out-of-box.tgz
    $ cd .mutt/
    $ cd scripts/
    $ cd ..
    $ cd misc
    $ cd ..
    $ cd scripts/
    $ vi bootstrapping-mutt.sh
    $ ./bootstrapping-mutt.sh

    $ cd .mail/
    $ cd ..
    $ rm .muttrc
    $ cd .mail
    $ cd ..
    $ rm .lbdbrc
    $ cat .mailcap
    $ rm .mailcap

    ///////////////////////////////////////////////////////////////////

    configure getmail 

    $ sudo apt install getmail
    $ sudo apt install procmail
    $ apt search getmail
    $ sudo apt install getmail4
    $ dpkg -L getmail4
    $ getmail
    $ mkdir .getmail
    $ cd .getmail/
    $ ls
    $ cp ~/mail-setup/.mutt/misc/getmailrc.template.sample .
    $ vi getmailrc.template.sample
    $ getmail
    $ mv getmailrc.template.sample getmailrc

    $ cat ~/.getmail/getmailrc

     1 [retriever]
     2 type = SimpleIMAPSSLRetriever
     3 server = imapmail.company.com
     4 port = 993
     5 username = "CCR
    ame"
     6 password = password
     7 mailboxes = ("Inbox", "Conversation History", )
     8 
     9 [destination]
    10 type = MDA_external
    11 path = /usr/bin/procmail
    12 
    13 [options]
    14 read_all = false
    15 verbose = 0
    16 delete = false
    17 delivered_to = false
    18 received = false
    19 message_log = ~/.getmail/getmail.intel.log
    View Code

    $ getmail
    $ cd ..
    $ ls

    configure procmail

    $ which procmail
    $ mv mail-setup/.mutt/misc/procmailrc.sample .procmailrc
    $ vi .procmailr
    $ vi .procmailrc

    $ cat ~/.procmailrc

     1 # http://gushue.net/mutt/procmailrc
     2 #
     3 
     4 MAILDIR=$HOME/Mail
     5 #DEFAULT=$MAILDIR/INBOX #completely optional
     6 LOGFILE=$HOME/.getmail/procmail.log
     7 YEAR=`date +%Y`
     8 
     9 
    10 # ----- check for existance of year's directory -----
    11 :0 ic
    12 * ? test ! -d $YEAR
    13 | mkdir -p $YEAR && chmod 0700 $YEAR
    14 
    15 #:0hc
    16 #* $^(Subject)${URGMATCH}
    17 #| formail -x Subject | growlnotify --sticky --image $HOME/.mutt/misc/mutt-mine-icon.png
    18 
    19 :0:
    20 $YEAR/Inbox/
    View Code

    $ mkdir Mail

    $ vi .getmail/getmailrc
    $ getmail
    $ getmail -v

    add getmail in cron

    $ crontab -e

    $ crontab -l

    * * * * * getmail

    or 

    $ while true; do sleep 10; getmail; done &

    2. 安装dovecot

    $ apt search dovecot

    $ sudo apt install dovecot-imapd

    $ restart dovecot    # ubuntu use upstart.  but not find dovecot in init.d

    $ cd /etc
    $ cd dovecot/
    $ ls
    $ vi dovecot.conf
    $ ll
    $ vi conf.d/
    $ vi dovecot.conf
    $ cd conf.d/
    $ ls
    $ ll
    $ vi 10-ssl.conf
    $ vi 20-imap.conf
    $ grep mail_loca *
    $ vi 10-mail.conf
    $ sudo vi 10-mail.conf
    $ vi 10-mail.conf
    $ grep passdb *
    $ vi 10-auth.conf

    查看状态

    $ service --status-all |grep dove

    $ dpkg -L dovecot-imapd

     配置doveconf

    $ doveconf -n

     1 # 2.2.9: /etc/dovecot/dovecot.conf
     2 # OS: Linux 3.16.0-33-generic x86_64 Ubuntu 14.04.3 LTS 
     3 mail_location = maildir:~/Mail/2016:LAYOUT=fs:INBOX=~/Mail/2016/Inbox:INDEX=~/Mail/.dovecot/indexes:CONTROL=~/Mail/.dovecot/control
     4 maildir_very_dirty_syncs = yes
     5 namespace inbox {
     6   inbox = yes
     7   location = 
     8   mailbox Drafts {
     9     special_use = Drafts
    10   }
    11   mailbox Junk {
    12     special_use = Junk
    13   }
    14   mailbox Sent {
    15     special_use = Sent
    16   }
    17   mailbox "Sent Messages" {
    18     special_use = Sent
    19   }
    20   mailbox Trash {
    21     special_use = Trash
    22   }
    23   prefix = 
    24 }
    25 passdb {
    26   driver = pam
    27 }
    28 protocols = " imap"
    29 ssl_cert = </etc/dovecot/dovecot.pem
    30 ssl_key = </etc/dovecot/private/dovecot.pem
    31 userdb {
    32   driver = passwd
    33 }
    View Code

    $ doveadm  

     add 

    "mail_location = maildir:~/Mail/Boxes`:LAYOUT=fs:INBOX=~/Mail/Boxes/Inbox:INDEX=~/Mail/.dovecot/indexes:CONTROL=~/Mail/.dovecot/control"

    to /etc/dovecot/conf.d/10-mail.conf

    debug dovecot

    http://www.anta.net/misc/telnet-troubleshooting/imap.shtml  (can not open)

    http://webcache.googleusercontent.com/search?q=cache:iGfa6OFcHGcJ:wiki.dovecot.org/TestInstallation+&cd=1&hl=zh-CN&ct=clnk&gl=us  (can not open)

    https://wiki.dovecot.org/TestInstallation

    telnet-troubleshooting imap.shtml

    dovecot "Authentication failed"

    3. 配置domainname

    $ domainname

  • 相关阅读:
    Linux内核同步方法
    C++11写轻量级AOP框架
    Typora夜樱主题
    MySQL添加主键和外键
    命题连接词和命题逻辑
    打印一个类全部信息的方法
    getClass()和instanceof以及类的equals方法
    多态
    在构造函数中调用另一个构造函数
    参数传递
  • 原文地址:https://www.cnblogs.com/shaohef/p/5242006.html
Copyright © 2011-2022 走看看