Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

If I select an email in Mail.app and do +C, I can then paste the entire email (including header info) in a rich text editor app, such as TextEdit or VoodooPad. However, I'm not able to paste it into a plain text editor like TextMate or into a terminal window.

(Oddly, I can paste into into TextEdit in plain text mode, which is exactly what I want to be able to do with other apps).

Why does it do this? Is there a workaround? Note that Plain Clip does not work as a workaround in this case.

share|improve this question
    
What type of email are you “selecting” and how? Does it have images? How do you include your “header info”? Are you going to Message -> Long headers? –  Martín Marconcini Oct 18 '10 at 16:28
    
I have learned to live with workarounds. You can paste your mail into TextEdit as plain text then copy the plain text from TextEdit and paste it into the app you want. –  Martin Oct 18 '10 at 19:26
    
+1 just for making me aware of Plain Clip :) –  Jon Hadley Oct 19 '10 at 12:39
    
Martin: I am selecting by clicking on the subject in the top pane of Mail.app. Then I'm hitting Cmd+C. This copies the headers along with the text. (No images in the email) –  Lorin Hochstein Oct 19 '10 at 16:19
    
A similar work-around I sometimes use. From Mail do a "Save As" to a text document on the desktop, then open that document with the text editor of your choice. Does include the major headers. –  GEdgar Feb 16 '12 at 16:11
add comment

2 Answers 2

up vote 3 down vote accepted

This is because of how you can program the pasteboard on Mac OS X.

Text editors expect the pasteboard to contain, well, text data. There are however several kinds of text: there's plain text, there's formatted (RTF) text, there's formatted text with embedded documents (RTFD), there's HTML-formatted text, and a bunch of others.

When you copy something, the application tells the pasteboard how this data can be represented. There are usually several suitable representations: for instance, copying your question exports data in the pasteboard that can be represented as a web archive, RTF data, and plain text in three different encodings. Plenty of types that applications are likely to support.

However, when you copy a mail from Mail, it exports only as two types of data: plain UTF-8 text and a RTFD document. Cocoa tries to paste as an RTFD document because it likes them better, but applications say "no no, I can't do that"; they usually support getting text from RTF, but not from RTFD since RTFD usually has embedded resources such as images, and you end up pasting nothing because the apps don't bother to look for the plain text data.

TextEdit, on its side, is able to edit RTFD documents, so it has no problem pasting the data.

share|improve this answer
    
I have pasted and copied emails from Mail.app into TextMate without major problems (other than losing formatting). The pasteboard service offers “alternatives” when the data is not representable. TextMate will grab the plain text utf alternative. –  Martín Marconcini Oct 18 '10 at 21:45
    
Martin Marconcini: I can select text inside an email, which is how I paste into TextMate. But I want to select the headers and the email text at the same time. –  Lorin Hochstein Oct 19 '10 at 16:21
add comment

On Lion (and possibly earlier; I haven't checked), Mail has this menu item which you might choose to use before copying a message to paste elsewhere:

View > Message > Plain Text Alternative

There's another option, but it opens a separate window and requires you to wade through potentially unhelpful email headers that are typically hidden:

View > Message > Raw Source

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.