* Sending and archiving emails with capture...
@ 2012-03-15 21:22 Jos'h Fuller
2012-03-15 21:44 ` Peter Salazar
0 siblings, 1 reply; 4+ messages in thread
From: Jos'h Fuller @ 2012-03-15 21:22 UTC (permalink / raw)
To: emacs-orgmode, Jos'h.Fuller
Hi!
Assuming I've got everything set up correctly and this email makes it
to the list, this is in response to Alan E. Davis' question about
sending an email from Emacs and saving a copy in org-mode.
I make the assumption here that your Emacs is set up to properly send
emails using the ~mail~ command. Also note that my
~org-capture-templates~ setup has more than just an email template.
Install the lines below just after your org-mode install.
To use:
- Invoke org-capture from any buffer with C-cc.
- Choose the Mail template ([m] key).
- Enter the recipient's address, then [enter].
- Enter the mail subject, then [enter].
- Your cursor is positioned at the start of the email.
- Write your email.
- C-c C-c sends it on its way!
This is very crude and could certainly be improved. However, perhaps
it's a reasonable starting point!
Jos'h
-- snip! --------------------------------------------------------------------
;; Capture Setup
(setq org-capture-templates
(quote
(("m" "Mail" entry (file+olp org-default-notes-file "Emails") "** Email %T
From: Your Name <yourname@yourcompany.com>
To: %^{Send mail to}
Subject: %^{Subject}
--text follows this line--
%?
_______________________________________________________________________________
This is a signature...")
("t" "todo" entry (file org-default-notes-file)
"* TODO %?\n%U\n%a\n %i" :clock-in t :clock-resume t)
("n" "note" entry (file org-default-notes-file)
"* %? :NOTE:\n%U\n%a\n %i" :clock-in t :clock-resume t)
("h" "Habit" entry (file org-default-notes-file)
"* NEXT %?\n%U\n%a\nSCHEDULED: %t .+1d/3d\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n %i"))))
(defun my-finalize-capture ()
"This is run from the org-capture-before-finalize hook just
before the indirect buffer is closed.
If the current local capture is a 'Mail' message, I extract it
and send it on it's way. Because I am cautious, I extract the
text from the org buffer and put it into a private temporary
buffer before sending it as an email.
This may not be the best way to do this..."
(message "* Running custom finalize hook...")
(if (string= "Mail" (org-capture-get :description))
(save-excursion
(goto-char (org-capture-get :begin-marker t))
(next-line) ; Skip past org slug line.
(let* ((msg (buffer-substring (point) (org-capture-get :end-marker t))))
(with-temp-buffer
(insert msg)
(mail-send)
))
))
)
(add-hook 'org-capture-before-finalize-hook 'my-finalize-capture)
(define-key global-map "\C-cc" 'org-capture)
_______________________________________________________________________________
Jos'h Fuller, Production Programmer
Arc Productions Ltd.
p: 416.682.5237 | f: 416.682.5209 | http://www.arcproductions.com
230 Richmond Street East | Toronto, ON M5A 1P4 |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Sending and archiving emails with capture...
2012-03-15 21:22 Sending and archiving emails with capture Jos'h Fuller
@ 2012-03-15 21:44 ` Peter Salazar
2012-03-15 21:52 ` Jos'h Fuller
0 siblings, 1 reply; 4+ messages in thread
From: Peter Salazar @ 2012-03-15 21:44 UTC (permalink / raw)
To: Jos'h Fuller; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 3270 bytes --]
Amazing.
I tried it and I get "Heading not found on level 1: Emails"
I must missing a step?
On Thu, Mar 15, 2012 at 5:22 PM, Jos'h Fuller <
Jos'h.Fuller@arcproductions.com> wrote:
>
> Hi!
>
> Assuming I've got everything set up correctly and this email makes it
> to the list, this is in response to Alan E. Davis' question about
> sending an email from Emacs and saving a copy in org-mode.
>
> I make the assumption here that your Emacs is set up to properly send
> emails using the ~mail~ command. Also note that my
> ~org-capture-templates~ setup has more than just an email template.
>
> Install the lines below just after your org-mode install.
>
> To use:
>
> - Invoke org-capture from any buffer with C-cc.
> - Choose the Mail template ([m] key).
> - Enter the recipient's address, then [enter].
> - Enter the mail subject, then [enter].
> - Your cursor is positioned at the start of the email.
> - Write your email.
> - C-c C-c sends it on its way!
>
> This is very crude and could certainly be improved. However, perhaps
> it's a reasonable starting point!
>
> Jos'h
>
>
> -- snip!
> --------------------------------------------------------------------
>
> ;; Capture Setup
>
> (setq org-capture-templates
> (quote
> (("m" "Mail" entry (file+olp org-default-notes-file "Emails") "**
> Email %T
> From: Your Name <yourname@yourcompany.com>
> To: %^{Send mail to}
> Subject: %^{Subject}
> --text follows this line--
> %?
>
>
> _______________________________________________________________________________
>
> This is a signature...")
> ("t" "todo" entry (file org-default-notes-file)
> "* TODO %?\n%U\n%a\n %i" :clock-in t :clock-resume t)
> ("n" "note" entry (file org-default-notes-file)
> "* %? :NOTE:\n%U\n%a\n %i" :clock-in t :clock-resume t)
> ("h" "Habit" entry (file org-default-notes-file)
> "* NEXT %?\n%U\n%a\nSCHEDULED: %t .+1d/3d\n:PROPERTIES:\n:STYLE:
> habit\n:REPEAT_TO_STATE: NEXT\n:END:\n %i"))))
>
> (defun my-finalize-capture ()
> "This is run from the org-capture-before-finalize hook just
> before the indirect buffer is closed.
>
> If the current local capture is a 'Mail' message, I extract it
> and send it on it's way. Because I am cautious, I extract the
> text from the org buffer and put it into a private temporary
> buffer before sending it as an email.
>
> This may not be the best way to do this..."
>
> (message "* Running custom finalize hook...")
>
> (if (string= "Mail" (org-capture-get :description))
> (save-excursion
> (goto-char (org-capture-get :begin-marker t))
> (next-line) ; Skip past org slug line.
> (let* ((msg (buffer-substring (point) (org-capture-get :end-marker
> t))))
> (with-temp-buffer
> (insert msg)
> (mail-send)
> ))
> ))
> )
>
> (add-hook 'org-capture-before-finalize-hook 'my-finalize-capture)
>
> (define-key global-map "\C-cc" 'org-capture)
>
>
> _______________________________________________________________________________
>
> Jos'h Fuller, Production Programmer
>
> Arc Productions Ltd.
>
> p: 416.682.5237 | f: 416.682.5209 |
> http://www.arcproductions.com
> 230 Richmond Street East | Toronto, ON M5A 1P4 |
>
>
[-- Attachment #2: Type: text/html, Size: 4346 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Sending and archiving emails with capture...
2012-03-15 21:44 ` Peter Salazar
@ 2012-03-15 21:52 ` Jos'h Fuller
2012-03-18 5:36 ` Peter Salazar
0 siblings, 1 reply; 4+ messages in thread
From: Jos'h Fuller @ 2012-03-15 21:52 UTC (permalink / raw)
To: Peter Salazar; +Cc: emacs-orgmode@gnu.org
Hi!
> I tried it and I get "Heading not found on level 1: Emails"
Sorry, I forgot to say that you need to make a heading in your org-default-notes-file (whatever that is) called "Emails":
* Tasks
* Done
* Emails
The emails will be filed under there, like this:
: * Emails
: ** Email <2012-03-15 Thu 15:20>
:
: From: Me <me@me.com>
: To: you@you.com
: Subject: Testing!
: --text follows this line--
: This is a test...
:
: _______________________________________________________________________________
:
: Signature!
See if that fixes it!
Jos'h Fuller, Production Programmer
p: 416.682.5200 x5395 | f: 416.682.5209 | Arc Productions Ltd. | 230 Richmond Street East | Toronto, ON M5A 1P4 | www.arcproductions.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Sending and archiving emails with capture...
2012-03-15 21:52 ` Jos'h Fuller
@ 2012-03-18 5:36 ` Peter Salazar
0 siblings, 0 replies; 4+ messages in thread
From: Peter Salazar @ 2012-03-18 5:36 UTC (permalink / raw)
To: Jos'h Fuller; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]
Awesome.
How do you get it to ignore the org star header (** Email) on the first
line?
I'd like to be able to open existing org subtrees in an indirect
buffer—ideally in mail-mode—and then mail-send the contents of the buffer.
When I try this at home, I get "Invalid header line."
On Thu, Mar 15, 2012 at 5:52 PM, Jos'h Fuller <
Jos'h.Fuller@arcproductions.com> wrote:
> Hi!
>
> > I tried it and I get "Heading not found on level 1: Emails"
>
> Sorry, I forgot to say that you need to make a heading in your
> org-default-notes-file (whatever that is) called "Emails":
>
> * Tasks
> * Done
> * Emails
>
> The emails will be filed under there, like this:
>
> : * Emails
> : ** Email <2012-03-15 Thu 15:20>
> :
> : From: Me <me@me.com>
> : To: you@you.com
> : Subject: Testing!
> : --text follows this line--
> : This is a test...
> :
> :
> _______________________________________________________________________________
> :
> : Signature!
>
> See if that fixes it!
>
> Jos'h Fuller, Production Programmer
> p: 416.682.5200 x5395 | f: 416.682.5209 | Arc Productions Ltd. | 230
> Richmond Street East | Toronto, ON M5A 1P4 | www.arcproductions.com
>
>
>
[-- Attachment #2: Type: text/html, Size: 1930 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-18 5:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 21:22 Sending and archiving emails with capture Jos'h Fuller
2012-03-15 21:44 ` Peter Salazar
2012-03-15 21:52 ` Jos'h Fuller
2012-03-18 5:36 ` Peter Salazar
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).