Adding Text File Attachments

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is OFF
Smilies are ON
Topic review
   

Expand view Topic review: Adding Text File Attachments

Re: Adding Text File Attachments

Post by OtterSoftware » 25 May 2010, 16:06

Hi Erik and apologies for the long delay in replying.

You can see a more complete example of this in the attachment I added to my other post at http://www.mulle-kybernetik.com/forum/viewtopic.php?f=5&t=59&p=101#p79 but the relevant code is:

NSString *attachmentPath = [[NSBundle mainBundle] pathForResource:@"textfile" ofType:@"txt"];
NSData *attachmentData = [NSData dataWithContentsOfFile:attachmentPath];
NSArray *attachments = [NSArray arrayWithObject:[EDObjectPair pairWithObjects:attachmentData:[attachmentPath lastPathComponent]]];

In Apple's Mail application the contents of the text file is simply inserted into the body of the message and I think that Google Mail shows the same thing as does my mail provider's webmail interface but that at least shows that there is an attachment (although you can't see it once you read the message.

The relevant headers from the email are:
Content-Type: multipart/mixed; boundary=EDMessagePart-12747952670
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0 (EDMessage Framework v1.1)

The (chopped) raw source is:
Content-Type: multipart/mixed; boundary=EDMessagePart-12747952670
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0 (EDMessage Framework v1.1)

This is a MIME encoded message.

--EDMessagePart-12747952670
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

An example message body
--EDMessagePart-12747952670
Content-Type: text/plain; name=textfile.txt
Content-Transfer-Encoding: base64

VGhpcyBpcyBhbiBleGFtcGxlIHRleHQgZmlsZS4=

--EDMessagePart-12747952670--

Re: Adding Text File Attachments

Post by erik » 23 Apr 2010, 01:45

How exactly do you attach the text files? And what is the resulting mime type for the text attachement?

Adding Text File Attachments

Post by OtterSoftware » 20 Apr 2010, 02:42

I'm trying to use the EDMessage framework to send an email with log files attached to it. The log files are text files and rather than adding them as attachments the contents of the text files are being included in the message's body. Is there a simple way around this?

Thank you for the frameworks too, the effort you have put into them is very much appreciated.

Top