Re: [O] html-email in org-mode

2016-11-07 Thread Joseph Vidal-Rosset
Many thanks John for this email and also for your very useful videos.

As I told you, I use sometimes gnus + org-mode to make roughly the
same things that  you make with m4ue. Your message  appears correctly in
two formats  in gnus: multipart/mixed  and text/html. In a  browser used
with gmail its html is perfect.

I confess  that I  do not  succeed to use  only gnus  for my  email, but
mainlywhenitis moreconvenientforprofessional
reasons. Unfortunately, I have not still succeed to use gnorb, because I
do not  understand clearly how  it works.  But even without  gnorb, gnus
works well in harmony with gmail in IMAP.

Maybe some  people in this  list could  share their experiences  with an
emacs email  client + org-mode  and help to  make the better  choice, if
possible?

Best wishes,

Jo. 






Re: [O] html-email in org-mode

2016-11-06 Thread John Kitchin
I can not reproduce your error.

I feel like when I saw that error it was from calling a send command
while in org-mode, and not in message-mode. 

Matt Price writes:

> John, I'm moving this over to this thread because I think my issues with
> htmlize-and-send might not be because of any errors in my setup.
>
> When I use John's htmlize-and-send, or any similar function, to attempt to
> send an html email from org-mode, I get an error from message-send:
> "Message already sent via mail; resend?" Attmepting to resend fails
> silently, and the message is neither sent nor saved to archives.
> Interestingly, the first time I try this in a new emacs session, I get no
> error message ( though the message doesn't actually get sent). This makes
> me wonder if there's something wrong with the way
> mu4e/message/htmlize-and-send is keeping track of messages.
>
> I've attached the minimal mail-test.el that I use to start emacs; I'm using
> a pretty recent emacs-git with the latest org-mode git, on Arch Linux, with
> offlineimap and nullmailer (which has a sendmail clone). If anyone out
> there has a moment to look at my config and tell me if they see anything
> wrong... I'd aprreciate it. Th
> anks,
>
> Matt


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] html-email in org-mode

2016-11-05 Thread Eric Brown
John Kitchin  writes:

> htmlize-mail.org
>
>
> * Send org files by html email so they look like org files.
>   :PROPERTIES:
>   :MAIL_FMT: html
>   :END:
>
> We might not always want a full export of an org heading to html for sending 
> an email. Eric Brown would like to just send something that looks like what 
> he sees in org-mode. There is another way to get html from emacs: htmlize! 
> Here is an example. Eric: if this is what you mean, see my modified 
> org-mime.el at https://github.com/jkitchin/scimax/blob/master/org-mime.el. 
>
> The command to send a subtree is: elisp:org-mime-subtree-htmlize
>
>
> #+BEGIN_EXAMPLE
> My comment was motivated by other usage where I wish that I could simply
> wrap an entire simple text, whitespace-formatted email message,
> e.g. generated from org export to a plain text buffer, with a Monospace
> directive so that webmail users could appreciate what I see with Sans
> Mono.
> #+END_EXAMPLE
>
> | a | b | c |
> | 4 | 5 | 6 |
>
> An equation 
> \(e^{i\pi} + 1 = 0\)
>
>
> A figure: 
>
> #+name: fig-particle
> #+attr_org: :width 30%
> ./images/Au-icosahedron-3.png
>
>
> A code block:
> #+BEGIN_SRC python :results output org drawer
> for i in range(5):
> print(i)
> #+END_SRC
>
> ** A subtree
>
> An orgmode reference: cite:Dominik201408. A figure reference: 
> ref:fig-particle.


Thanks John. This is very helpful!



Re: [O] html-email in org-mode

2016-11-04 Thread Matt Price
John, I'm moving this over to this thread because I think my issues with
htmlize-and-send might not be because of any errors in my setup.

When I use John's htmlize-and-send, or any similar function, to attempt to
send an html email from org-mode, I get an error from message-send:
"Message already sent via mail; resend?" Attmepting to resend fails
silently, and the message is neither sent nor saved to archives.
Interestingly, the first time I try this in a new emacs session, I get no
error message ( though the message doesn't actually get sent). This makes
me wonder if there's something wrong with the way
mu4e/message/htmlize-and-send is keeping track of messages.

I've attached the minimal mail-test.el that I use to start emacs; I'm using
a pretty recent emacs-git with the latest org-mode git, on Arch Linux, with
offlineimap and nullmailer (which has a sendmail clone). If anyone out
there has a moment to look at my config and tell me if they see anything
wrong... I'd aprreciate it. Th
anks,

Matt
;; example configuration for mu4e
(add-to-list 'load-path "/home/matt/src/mu/mu4e/" )
(add-to-list 'load-path "/home/matt/src/org-mode/lisp/" )
(add-to-list 'load-path "/home/matt/src/org-mode/contrib/lisp/" )

;; make sure mu4e is in your load-path
(require 'mu4e)
(require 'org)
(require 'org-mime)


;; Only needed if your maildir is _not_ ~/Maildir
;; Must be a real dir, not a symlink
(setq mu4e-maildir "/home/matt/UofTMail/")

;; these must start with a "/", and must exist
;; (i.e.. /home/user/Maildir/sent must exist)
;; you use e.g. 'mu mkdir' to make the Maildirs if they don't
;; already exist

;; below are the defaults; if they do not exist yet, mu4e offers to
;; create them. they can also functions; see their docstrings.
(setq mu4e-sent-folder   "/Sent")
(setq mu4e-drafts-folder "/Drafts")
(setq mu4e-trash-folder  "/Trash")
(setq mu4e-refile-folder  "/Archives")

;; smtp mail setting; these are the same that `gnus' uses.
(setq
 ;;message-send-mail-function   'smtpmail-send-it
 smtpmail-default-smtp-server "smtp.utoronto.ca"
 smtpmail-smtp-server "smtp.utoronto.ca"
 smtpmail-local-domain"utoronto.ca")


;; use msmtp instead of sendmail!
;; actually we're using nullmailer now. Both are great, but nullmailer send is subjetively instantaneous
(setq message-send-mail-function 'message-send-mail-with-sendmail)
;; instead of sending directly with msmtp, sned with the enqueue script
;;(setq sendmail-program "/usr/local/bin/msmtp-enqueue.sh")
(setq sendmail-program "/usr/bin/sendmail")
;;(setq sendmail-program "/usr/bin/msmtp")

  ;;; This line allows you to store a quick link to the relevant email in a TODO item.
  ;;; thank you, Pragmatic Emacs: http://pragmaticemacs.com/emacs/master-your-inbox-with-mu4e-and-org-mode/
;;store org-mode links to messages
(require 'org-mu4e)
;;store link to message if in header view, not to header query
(setq org-mu4e-link-query-in-headers-mode nil)



;; the maildirs you use frequently; access them with 'j' ('jump')
(setq   mu4e-maildir-shortcuts
'(("/inbox"   . ?i)
  ("/Archives" . ?a)
  ("/Sent". ?s)))

;; a  list of user's e-mail addresses
(setq mu4e-user-mail-address-list '("matt.pr...@utoronto.ca" "mopto...@gmail.com"))

;; when you want to use some external command for text->html
;; conversion, e.g. the 'html2text' program
;; (setq mu4e-html2text-command "html2text")
;; commenting out for testing
;; (require 'mu4e-contrib)
;; (setq mu4e-html2text-command 'mu4e-shr2text)
;; (add-hook 'mu4e-view-mode-hook
;;   (lambda()
;; ;; try to emulate some of the eww key-bindings
;; (local-set-key (kbd "") 'shr-next-link)
;; (local-set-key (kbd "") 'shr-previous-link)))


;; the headers to show in the headers list -- a pair of a field
;; and its width, with `nil' meaning 'unlimited'
;; (better only use that for the last field.

;; commenting out for testing
;; These are the defaults:
;; (setq mu4e-headers-fields
;;   '( (:human-date  .  25);; alternatively, use :human-date
;;  (:flags .   6)
;;  (:mailing-list .   10)
;;  ;;(:attachments   .   6)
;;  (:from-or-to  .  22)
;;  (:subject   .  nil))) ;; alternatively, use :thread-subject

;; program to get mail; alternatives are 'fetchmail', 'getmail'
;; isync or your own shellscript. called when 'U' is pressed in
;; main view.

;; If you get your mail without an explicit command,
;; use "true" for the command (this is the default)
(setq mu4e-get-mail-command "offlineimap")

;; general emacs mail settings; used when composing e-mail
;; the non-mu4e-* stuff is inherited from emacs/message-mode
(setq mu4e-reply-to-address "matt.pr...@utoronto.ca"
  user-mail-address "matt.pr...@utoronto.ca"
  user-full-name  "Matt Price")
(setq mu4e-compose-signature
  "")

;; smtp mail setting
;; I don't think this is being used by nullmailer at all, so 

Re: [O] html-email in org-mode

2016-11-01 Thread Alan Schmitt
On 2016-10-29 15:37, John Kitchin  writes:

> On the org-mode mailing list there was some discussion about sending
> html mail using orgmode. The support for this in mu4e is deprecated.
> There is the org-mime library though, and it supports a lot of what is
> needed for this. I am going to send this post to the orgmode mailing
> list as an html mail to make sure it works. It should show as a text
> mail in mu4e, and an html mail in a browser.

It's looking great in gnus, by the way. Equations and images are
displayed very nicely. Thanks!

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2016-09: 401.03, 2015-09: 397.63


signature.asc
Description: PGP signature


Re: [O] html-email in org-mode

2016-11-01 Thread Eric Brown
John Kitchin  writes:

> Do you mean monospace in the whole html message, e.g. something like Courier?
>
> Or just in a table? I do not think you can control the font in plain
> text emails.
>
> You can set the font in the td elements of a table like this (I used
> cursive because it was easy to see.
>
> #+BEGIN_SRC emacs-lisp
> (defun italicize-table (data backend info)
>   (with-temp-buffer
> (insert data)
> (goto-char (point-min))
> (while (re-search-forward "   (replace-match " (message"got %s" (buffer-string))
> (buffer-string)))
>
>
> (add-to-list 'org-export-filter-table-functions 'italicize-table)
> #+END_SRC
>
> After you run that, the tables in html have italicized/cursive elements
> in them. And probably all other exports to html too ;)
>

Thanks, this is extremely useful, as well.  In retrospect, I think my
question may be a bit moot, as the HTML formatting would probably allow
tables to remain aligned regardless of length of any one cell.

My comment was motivated by other usage where I wish that I could simply
wrap an entire simple text, whitespace-formatted email message,
e.g. generated from org export to a plain text buffer, with a Monospace
directive so that webmail users could appreciate what I see with Sans
Mono.



Re: [O] html-email in org-mode

2016-10-30 Thread John Kitchin
Do you mean monospace in the whole html message, e.g. something like Courier?

Or just in a table? I do not think you can control the font in plain
text emails.

You can set the font in the td elements of a table like this (I used
cursive because it was easy to see.

#+BEGIN_SRC emacs-lisp
(defun italicize-table (data backend info)
  (with-temp-buffer
(insert data)
(goto-char (point-min))
(while (re-search-forward " writes:
>
>> 1.1.3 Tables
>>
>>  Table 1: A table for you.  
>>   x  y
>>   1  2
>>
>
> Hi John,
>
> I haven't (yet) found the email thread that you had alluded to, but I
> think this post is awesome.  Works well for me!
>
> One suggestion/thought:
>
> I would like to do is force monospace font in these messages, since the
> recipients I typically send to will have variable width fonts, and
> tables and the like tend to get messed up.
>
> How might this be done?
>
> Best regards,
> Eric


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] html-email in org-mode

2016-10-30 Thread tbanelwebmin

* Awesome
This is awesome!

* Simple
I followed your instructions, and in 2 minutes I was able to send a
/1st/ mail from Org Mode

* Thanks
Thanks John for showing that.


Re: [O] html-email in org-mode

2016-10-30 Thread Marcin Borkowski

On 2016-10-30, at 15:34, Eric Brown  wrote:

> One suggestion/thought:
>
> I would like to do is force monospace font in these messages, since the
> recipients I typically send to will have variable width fonts, and
> tables and the like tend to get messed up.

+20! (that is, +243290200817664)

I'm not very interested in sending HTML emails, but this would be
AWESOME.  I sometimes send ASCII-art-ish tables (like Org-mode ones, or
Ledger reports) by email, and opening them in variable-width font is
rather messy indeed.

TIA,

-- 
Marcin Borkowski



Re: [O] html-email in org-mode

2016-10-30 Thread Eric Brown
John Kitchin  writes:

> 1.1.3 Tables
>
>  Table 1: A table for you.  
>   x  y
>   1  2
>

Hi John,

I haven't (yet) found the email thread that you had alluded to, but I
think this post is awesome.  Works well for me!

One suggestion/thought:

I would like to do is force monospace font in these messages, since the
recipients I typically send to will have variable width fonts, and
tables and the like tend to get messed up.

How might this be done?

Best regards,
Eric