struggling to send html msgs w/ org + mu4e + nullmailer

89 views
Skip to first unread message

Matt Price

unread,
Nov 17, 2016, 1:03:23 PM11/17/16
to mu-di...@googlegroups.com
Hello,

I am having a very difficult time sending html messages with mu4e, org-mime, and org-mu4e. 

Text-ony messages send with no problem.

I can also send out html messages when using org-mu4e-compose-org-mode by manually invoking org-mime-htmlize, navigating to the header section, and then invoking message-send-and-exit.

However, if I write my own function to combine these actions, the mail is not sent. Instead, I get a message "Already sent message via mail; resend? (y or n) ". Typing y "sends" the message, but no message is actually sent out, and no message is saved to my "sent" folder. The message just vanishes.

I use nullmailer to send out my mail -- I don't think this is relevant, but wanted to include it for completeness. 
Org version is recent: Org mode version 9.0 (release_9.0-60-g047451 @ /home/matt/src/org-mode/lisp/)
Emacs is from the Arch Linux emacs-git package: GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.1) of 2016-11-04
mu is also pretty recent, latest commit from a weeek ago: b2cfc0201067d0b22e66f5f01e94fb14ddb08530

I've attached a minimal emacs config that just loads org, mu4e, etc., and sets the relevant folders, along with a couple of small functions (inspired by John Kitchin's recent blog post http://kitchingroup.cheme.cmu.edu/blog/2016/10/29/Sending-html-emails-from-org-mode-with-org-mime/).  I would be so, so appreciative if other people can check whether similar configurations give you problems. Interestingly, the first html email I send out in a new session always works.  I have to send out at least 2 before I start to see the error. 

many, many thanks!
Matt

mail-minimal.el

Dirk-Jan C. Binnema

unread,
Nov 17, 2016, 1:26:14 PM11/17/16
to mu-di...@googlegroups.com
Hi Matt,
As I just wrote to Stig, org-mu4e-compose-org-mode has been deprecated
for quite a while now and is not maintained anymore. Perhaps the latest
org-version or maybe something else causes the mentioned behavior.

Anyway, I'd recommend org-mime directly for now. It may not be so
'smooth', but at least it has a chance of working. And of course I'd be
interested in hearing from volunteers on working on the mu4e support for
that.

Might give it a shot myself at some point, but my hacking time is a
scarce commodity.


Cheers,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

Matt Price

unread,
Nov 18, 2016, 12:11:59 AM11/18/16
to mu-di...@googlegroups.com
Sorry not to have checked the ML before sending! And thanks for the response.

As you guessed, the problem is some instability in org-mu4e-compose-org-mode. 

Turning it off before sending the message fixed the bug in my code:

(defun htmlize-and-send ()
  "When in an org-mu4e-compose-org-mode message, htmlize and send it."
  (interactive)
  (when (member 'org~mu4e-mime-switch-headers-or-body post-command-hook)
    (org-mime-htmlize)
    (org-mu4e-compose-org-mode)
    (message-send-and-exit)))

just using org-mime to htmlize and send also works:

 (defun mwp-htmlize-and-send ()
    "When in an org-mu4e-compose-org-mode message, htmlize and send it."
    (interactive)
    (message "calling htmlize-and-send")
      (org-mime-htmlize)
      (message "ḧtmlized successfully")
      (when (member 'org~mu4e-mime-switch-headers-or-body post-command-hook)
    (org-mu4e-compose-org-mode))   
      (message-send-and-exit)
      (message "message hopefully sent and saved"))

 
Gmail seems to have messed the indentation up, sorry!

I had some further trouble when I tried to turn on org-mu4e-compose-org-mode as a hook to mu4e-compose-mode. I'm pretty sure there's some kind of a loop related to the funky post-command-hook-setting internal function org~mu4e-mime-switch-headers-or-body. Anyway, turning off hte hook and applying the above hook fixed my issue.  Added a couple of keybindings and now everything works!

m




Might give it a shot myself at some point, but my hacking time is a
scarce commodity.


Cheers,
Dirk.

--
Dirk-Jan C. Binnema                  Helsinki, Finland
e:dj...@djcbsoftware.nl           w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

--
You received this message because you are subscribed to the Google Groups "mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mu-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages