{"action":"created","issue":{"url":"https://api.github.com/repos/djcb/mu/issues/586","labels_url":"https://api.github.com/repos/djcb/mu/issues/586/labels{/name}","comments_url":"https://api.github.com/repos/djcb/mu/issues/586/comments","events_url":"https://api.github.com/repos/djcb/mu/issues/586/events","html_url":"https://github.com/djcb/mu/issues/586","id":57962364,"number":586,"title":"Documented email selection hook lacks support for newly composed messages","user":{"login":"stefanv","id":45071,"avatar_url":"https://avatars.githubusercontent.com/u/45071?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanv","html_url":"https://github.com/stefanv","followers_url":"https://api.github.com/users/stefanv/followers","following_url":"https://api.github.com/users/stefanv/following{/other_user}","gists_url":"https://api.github.com/users/stefanv/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanv/subscriptions","organizations_url":"https://api.github.com/users/stefanv/orgs","repos_url":"https://api.github.com/users/stefanv/repos","events_url":"https://api.github.com/users/stefanv/events{/privacy}","received_events_url":"https://api.github.com/users/stefanv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-02-17T18:31:14Z","updated_at":"2015-06-28T17:42:24Z","closed_at":null,"body":"In the documentation, a compose-hook is provided for setting the \"From\" address based on the message  responded to:\r\n\r\nhttp://www.djcbsoftware.nl/code/mu/mu4e/Compose-hooks.html\r\n\r\nHowever, this hook does not take into account composition of new messages, so that the address for *newly composed messages* will not always be the *default* email.\r\n\r\nHere is one potential workaround:\r\n\r\n```elisp\r\n(add-hook 'mu4e-compose-pre-hook\r\n  (defun my-set-from-address ()\r\n    \"Set the From address based on the To address of the original.\"\r\n    (let ((msg mu4e-compose-parent-message)\r\n          (default-address \"default@mydomain.com\"))\r\n      (setq user-mail-address default-address)\r\n      (when msg\r\n        (setq user-mail-address\r\n              (cond\r\n               ((mu4e-message-contact-field-matches msg :to \"other@other.com\")\r\n                \"other@other.com\")\r\n               (t default-address)))))))\r\n```"},"comment":{"url":"https://api.github.com/repos/djcb/mu/issues/comments/116303290","html_url":"https://github.com/djcb/mu/issues/586#issuecomment-116303290","issue_url":"https://api.github.com/repos/djcb/mu/issues/586","id":116303290,"user":{"login":"danielsz","id":859131,"avatar_url":"https://avatars.githubusercontent.com/u/859131?v=3","gravatar_id":"","url":"https://api.github.com/users/danielsz","html_url":"https://github.com/danielsz","followers_url":"https://api.github.com/users/danielsz/followers","following_url":"https://api.github.com/users/danielsz/following{/other_user}","gists_url":"https://api.github.com/users/danielsz/gists{/gist_id}","starred_url":"https://api.github.com/users/danielsz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielsz/subscriptions","organizations_url":"https://api.github.com/users/danielsz/orgs","repos_url":"https://api.github.com/users/danielsz/repos","events_url":"https://api.github.com/users/danielsz/events{/privacy}","received_events_url":"https://api.github.com/users/danielsz/received_events","type":"User","site_admin":false},"created_at":"2015-06-28T17:42:24Z","updated_at":"2015-06-28T17:42:24Z","body":"@djcb @zakkak \r\n\r\nRegarding smtp configuration for multiple accounts, the configuration in Emacs is superfluous if you use [msmtp](http://msmtp.sourceforge.net/), which knows which smtp server to select based on the `From` address.  \r\n "}}