README (4452B)
1 $ echo >~/.w3mail/in; tail -f ~/.w3mail/in | xargs -n1 -P20 w3mail 2>>~/.w3mail/log & 2 $ tcpserver 127.0.0.1 3333 dirpop3d ~/.w3mail/inbox & 3 4 w3mail 5 ====== 6 7 Written by Tomas Hlavaty <tom-at-logand.com> in 2010. 8 9 Introduction 10 ============ 11 12 w3mail is a program that sends a web page by email. 13 14 There are many ways of browsing the Web. In most cases, I prefer 15 using my email reader for managing web pages I read. No excessive 16 amount of open tabs in my web browser, smaller memory usage, better 17 readibility and powerful management of unread and read web pages, 18 their marking, expiry and deletion. It's asynchronous and the actual 19 reading takes minimum keystrokes and no aiming with mouse at all. I'm 20 also using the excelent org-mode http://orgmode.org/ on daily basis 21 and my email reader Gnus is very well integrated with it. 22 23 http://lwn.net/Articles/262570/ 24 25 To look at page I send mail to a demon which runs wget and mails 26 the page back to me. It is very efficient use of my time, but 27 it is slow in real time. -- rms 28 29 Dependencies 30 ============ 31 32 Linux only. 33 34 Runtime depends on: wget, md5sum, sendmail (mailutils). 35 36 Build depends on: git, gcc. 37 38 Download 39 ======== 40 41 Clone the git repository: 42 43 $ git clone http://logand.com/git/w3mail.git 44 45 Building 46 ======== 47 48 Switch to the new directory and make the w3mail executable: 49 50 $ cd w3mail 51 $ make 52 53 Configuration 54 ============= 55 56 The command-line arguments of w3mail are: [[cmd from to host] url]. 57 58 In case all arguments are supplied, no configuration is necessary. 59 60 A configuration file ~/.w3mail needs to be created in case w3mail is 61 called with one argument only. The configuration file must contain 62 four lines, each line for one omited argument in the command-line 63 order. 64 65 --- start of ~/.w3mail --- 66 ssh user.name@host.name -e none /usr/lib/sendmail -t 67 email@address 68 email@address 69 host.name 70 --- end of ~/.w3mail --- 71 72 Change the user name, host name and email addresses to suit your 73 needs. You could set the first line to "sendmail -t" if you have 74 sendmail installed locally. In my case, I use ssh to my server and 75 invoke sendmail there. 76 77 It is convenient to put the w3mail program somewhere reachable from 78 $PATH, e.g. create a symlink to the w3mail executable file in your 79 ~/bin directory (if the ~/bin directory is in your $PATH) or add the 80 w3mail git directory into your $PATH. 81 82 Invocation from shell 83 ===================== 84 85 a) Send single web page: 86 87 $ w3mail 'http://logand.com/' 88 89 b) Send many web pages: 90 91 First save the URLs into a file, one URL per line. Then run: 92 93 $ cat file | w3mail 94 95 Or much faster in parallel with maximum 20 processes: 96 97 $ cat file | xargs -n1 -P20 w3mail 98 99 c) Run w3mail in background 100 101 First start the server: 102 103 $ echo >~/.w3mail.in; tail -f ~/.w3mail.in | xargs -n1 -P20 w3mail 2>>~/.w3mail.log & 104 105 Then request sending web pages by running: 106 107 $ echo 'url' >>~/.w3mail.in 108 109 or 110 111 $ cat file >>~/.w3mail.in 112 113 Watch the log for errors: 114 115 $ tail -f ~/.w3mail.log 116 117 Using w3mail with Emacs 118 ======================= 119 120 Put the following emacs-lisp code into your ~/.emacs file: 121 122 --- begin cut--- 123 (defun w3mail (url &optional new-window) 124 (interactive (browse-url-interactive-arg "URL: ")) 125 (shell-command (format "w3mail '%s' &" (browse-url-encode-url url)))) 126 127 (defun w3m-w3mail (url) 128 (interactive (list (w3m-input-url nil nil nil nil 'feeling-lucky))) 129 (when (and (stringp url) 130 (not (interactive-p))) 131 (setq url (w3m-canonicalize-url url))) 132 (set-text-properties 0 (length url) nil url) 133 (setq url (w3m-uri-replace url)) 134 (unless (or (w3m-url-local-p url) 135 (string-match "\\`about:" url)) 136 (w3m-string-match-url-components url) 137 (setq url (concat 138 (w3m-url-transfer-encode-string 139 (substring url 0 (match-beginning 8)) 140 (or w3m-current-coding-system 141 w3m-default-coding-system)) 142 (if (match-beginning 8) 143 (concat "#" (match-string 9 url)) 144 "")))) 145 (w3mail url)) 146 147 (global-set-key [f5] 'w3m-w3mail) 148 --- end cut --- 149 150 Pressing f5 key will ask for the URL of the web page to be send. 151 152 It is better to run the w3mail as a server as mentioned above and then 153 it is possible to replace the "w3mail '%s' &" parameter in w3mail 154 emacs-lisp function by "echo '%s' >>~/.w3mail.in". This won't block 155 emacs at all. 156 157 Licence 158 ======= 159 160 GPLv3+ 161 162 Feedback 163 ======== 164 165 Please send me an email.