Emacs的fans没有理由离开emacs去看邮件,看到很多人都在为gmail的恼人设置而烦恼,特花了些精力研究
一番。总的来说,连不上gmail主要是ssl的问题,一般是stunnel的设置不对。
正确的方法是启动/etc/init.d/stunnel4 服务,然后直接用本地服务进行收发。按如下方法配置stunnel4:
1-编辑 /etc/default/stunnel4:
------------------------------------------------------
# /etc/default/stunnel
# Julien LEMOINE <speedblue@debian.org>
# September 2003
# Change to one to enable stunnel automatic startup
ENABLED=1
FILES="/etc/stunnel/*.conf"
OPTIONS=""
# Change to one to enable ppp restart scripts
PPP_RESTART=0
2-编辑/etc/stunnel/stunnel.conf:
------------------------------------------------------
; Sample stunnel configuration file by Michal Trojnara 2002-2009
; Some options used here may not be adequate for your particular configuration
; Please make sure you understand them (especially the effect of the chroot jail)
; Certificate/key is needed in server mode and optional in client mode
;cert = /etc/ssl/certs/stunnel.pem
;key = /etc/ssl/certs/stunnel.pem
; Protocol version (all, SSLv2, SSLv3, TLSv1)
sslVersion = SSLv3
; Some security enhancements for UNIX systems - comment them out on Win32
chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
; PID is created inside the chroot jail
pid = /stunnel4.pid
; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
;compression = rle
; Workaround for Eudora bug
;options = DONT_INSERT_EMPTY_FRAGMENTS
; Authentication stuff
;verify = 2
; Don't forget to c_rehash CApath
; CApath is located inside chroot jail
;CApath = /certs
; It's often easier to use CAfile
;CAfile = /etc/stunnel/certs.pem
; Don't forget to c_rehash CRLpath
; CRLpath is located inside chroot jail
;CRLpath = /crls
; Alternatively you can use CRLfile
;CRLfile = /etc/stunnel/crls.pem
; Some debugging stuff useful for troubleshooting
debug = 7
output = /var/log/stunnel4/stunnel.log
; Use it for client mode
client = yes
; Service-level configuration
[pop3s]
accept = 995
connect = 110
[imaps]
accept = 993
connect = 143
[ssmtp]
accept = 465
connect = 25
;;
;; gmail seting
;;
[gmail-pops]
accept = 9959
connect = imap.gmail.com:995
[gmail-imaps]
accept = 9939
connect = imap.gmail.com:993
[gmail-ssmtp]
accept = 4659
connect = imap.gmail.com:465
;[https]
;accept = 443
;connect = 80
;TIMEOUTclose = 0
; vim:ft=dosini
3-完成以上修改后在终端运行:
sudo /etc/init.d/stunnel4 restart
下面说说如何测试,首先打开一个终端:
netstat -an | grep -iw LISTEN
查看输出有无如下显示:
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN
成功后继续执行如下命令:
telnet localhost 143
如果得到下面的结果,恭喜你,成功了!
telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
*OK Gimap ready for requests from 71.65.199.7 c5if2789008nfi.67
继续输入:
01 LOGIN username@gmail.com password
(记得把username@gmail和password替换成你自己的帐号)
不出意外的话,即将看到如下信息:
01 OK username@gmail.com authenticated (Success)
当然这没什么好玩的,只是说明你成功了。
02 LOGOUT
*BYE LOGOUT Requested
02 OK 73 good day (Success)
Connection closed by foreign host.
4-配置.emacs,加入如下设置:
------------------------------------------------------
;;
;; esun-mew.el
;;
;;
;; mew 邮件设置
;;
;;(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mew")
(setq load-path (cons "/usr/local/share/emacs/site-lisp/mew" load-path))
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
(setq mew-icon-directory "/usr/local/share/emacs/site-lisp/mew/etc")
(setq mew-use-cached-passwd t)
(if (boundp 'read-mail-command)
(setq read-mail-command 'mew))
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
(setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
(define-mail-user-agent
'mew-user-agent
'mew-user-agent-compose
'mew-draft-send-message
'mew-draft-kill
'mew-send-hook))
(setq mew-pop-size 0)
(setq mew-smtp-auth-list nil)
(setq toolbar-mail-reader 'Mew)
(set-default 'mew-decode-quoted 't)
(when (boundp 'utf-translate-cjk)
(setq utf-translate-cjk t)
(custom-set-variables
'(utf-translate-cjk t)))
(if (fboundp 'utf-translate-cjk-mode)
(utf-translate-cjk-mode 1))
;;
;;用w3m来读html格式邮件
;;w3m的使用将在以后讲到
;;
(setq mew-mime-multipart-alternative-list '("Text/Html" "Text/Plain" "*."))
(condition-case nil
(require 'mew-w3m)
(file-error nil))
(setq mew-use-text/html t)
;;
;;邮箱设置
;;
(setq mew-config-alist '(
("default"
("name" . "yourname")
("user" . "yourname")
("mail-domain" . "xxx.com")
("pop-server" . "pop.xxx.com")
("pop-port" . "110")
("pop-user" . "your-mail-username")
("pop-auth" . pass)
("smtp-server" . "smtp.xxx.com")
("smtp-port" . "25")
("smtp-user" . "your-smtp-username")
("smtp-auth-list" . ("CRAM-MD5" "LOGIN" "PLAIN"))
("smtp-mail-from" . "your-mail-address"))
("gmail"
("name" . "your-gmail-name")
("user" . "your-gmail-name")
("mail-domain" . "gmail.com")
("pop-server" . "127.0.0.1")
;;("pop-ssl" . t)
;;("proto" . "+")
("pop-port" . "9959")
("pop-auth" . pass)
("pop-user" . "your-gmail-user")
("smtp-server" . "127.0.0.1")
;;("smtp-ssl" . t)
("smtp-port" . "4659")
("smtp-user" . "your-gmail-user")
("smtp-auth-list" . ("CRAM-MD5" "LOGIN" "PLAIN"))
("smtp-mail-from" . "your-gmail-address"))
))
;;(setq mew-ssl-verify-level 0)
;;(setq mew-prog-ssl "/usr/bin/stunnel")
如果还是不行的话,只能是人品了...
在emacs中使用mew收发电子邮件的一些设置
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
-
- 帖子: 52
- 注册时间: 2007-02-15 16:04
-
- 帖子: 52
- 注册时间: 2007-02-15 16:04
Re: 在emacs中使用mew收发电子邮件的一些设置
重新安装了一遍ununtu9.10,发现些问题:
1-stunnel4 不能随系统自动启动
2-gnome下emacs23 gnus菜单不能正确显示
查看了一些资料,解释如下:
1-是stunnel4的bug
2-是gnome2.8的兼容问题
都不是自己能解决的,我的处理方法:
1-登录后执行:sudo /etc/init.d/stunnel4 restart
2-关掉emacs的菜单!
9.10不无遗憾,但速度确实比9.04快!
1-stunnel4 不能随系统自动启动
2-gnome下emacs23 gnus菜单不能正确显示
查看了一些资料,解释如下:
1-是stunnel4的bug
2-是gnome2.8的兼容问题
都不是自己能解决的,我的处理方法:
1-登录后执行:sudo /etc/init.d/stunnel4 restart
2-关掉emacs的菜单!
9.10不无遗憾,但速度确实比9.04快!
-
- 帖子: 52
- 注册时间: 2007-02-15 16:04
Re: 在emacs中使用mew收发电子邮件的一些设置
最后的解决方案:
1-编辑 /etc/rc.local这个文件,添加:
# fix stunnel4
/etc/init.d/stunnel4 restart
2-卸载emacs23及相关软件包,安装emacs-snapshot(这是比较新的版本,已经解决了gtk的兼容问题)
基本完美了!
1-编辑 /etc/rc.local这个文件,添加:
# fix stunnel4
/etc/init.d/stunnel4 restart
2-卸载emacs23及相关软件包,安装emacs-snapshot(这是比较新的版本,已经解决了gtk的兼容问题)
基本完美了!
-
- 帖子: 52
- 注册时间: 2007-02-15 16:04
Re: 在emacs中使用mew收发电子邮件的一些设置
该死的stunnel4! 也只好学着老外开骂了,上面第一招还是时灵时不灵的...
-
- 帖子: 11
- 注册时间: 2012-03-23 13:34
Re: 在emacs中使用mew收发电子邮件的一些设置
哥们问下哈,
我这边按你上面陪过stunnel.conf后,sudo /etc/init.d/stunnel4 restart 报错,说 pid没设,但是我设了的啊。
还有那个cert貌似也没有,怎么生成一个啊。
mb的, 就是想配个emacs收收邮件, 整死人啊
我这边按你上面陪过stunnel.conf后,sudo /etc/init.d/stunnel4 restart 报错,说 pid没设,但是我设了的啊。
还有那个cert貌似也没有,怎么生成一个啊。
mb的, 就是想配个emacs收收邮件, 整死人啊