Emailing RTF
Emailing RTF
- Subject: Emailing RTF
- From: James Spencer <email@hidden>
- Date: Sun, 10 Oct 2004 11:05:51 -0500
I'm hoping some kind soul can give me some direction short of having to
give myself a complete education in MIME and text encoding. I'm
trying to take the attributed text from a NSTextView and send it in
RTF format in an email through Pantomime. As all I will be sending is
the single RTF message, I have assumed I do not need to a MIME
multipart message so I've been trying variations on the following where
tempMessage is a Pantomime Message that is being correctly addressed
and theMessageAsTextStorage is the text storage from my text view.
Note that I've been looking at what I receive if I send myself a RTF
message using Mail
[tempMessage setContentType: @"text/enriched"]; //
Content-Type
[tempMessage setContentTransferEncoding: 0]; // 7-bit
[tempMessage setCharset: @"us-ascii"];
// get the RTF data
NSData *theData = [theMessageAsTextStorage RTFFromRange:
NSMakeRange(0, [[theMessageAsTextStorage string]length])
documentAttributes:nil];
[tempMessage setContent:theData];
The above appears (based on what I expect raw RTF to look like but I
admit I'm no more educated on RTF than I am on MIME and email) to send
RTF but at least Mail (I've not tried it with any other mail readers)
is unable to render the formatted text, instead giving me something
like the following (which is how it appears in Mail when my original
text view simply contained "Test Message formatted in Helvetica 12
Bold" which was in fact formatted in Helvetica 12 bold :
{\rtf1\mac\ansicpg10000\cocoartf102 {\fonttbl\f0\fswiss\fcharset77
Helvetica-Bold;} {\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx56
00\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Test Message formatted in Helvetica 12 Bold}
One of my problems is, of course, that I can't figure out if the
problem is related to my use of Pantomime, i.e. am I setting the
content to the correct type of object and/or setting the header fields
correctly or whether I need to revisit how my original message is
encoded between ASCII and Unicode. Any direction would be greatly
appreciated.
James P. Spencer
Rochester, MN
email@hidden
"Badges?? We don't need no stinkin badges!"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden