NSData & Mime Types...
NSData & Mime Types...
- Subject: NSData & Mime Types...
- From: Kevin Muldoon <email@hidden>
- Date: Fri, 19 Aug 2011 08:51:06 -0400
I've developed an application using EDMessage Frameworks which sends
emails with attached PDF to a OSX fax server (running 4-Sight FAX v
7.x). The fax server converts the attached PDF into a 1-bit tiff and
sends it to a fax number specified in the body of the email.
This email w/attachment works very well with all sorts of email
systems, however the fax server 4-Sight FAX v 7.x rejects the
EDMessage email saying it's not formatted properly. After examining
the raw headers of a successful email->fax to 4-Sight FAX vs. an
unsuccessful email->fax which EDMessage created, I have the following
question.
I suspect my Content-Type needs to be specified as Content-Type:
application/pdf rather than Content-Type: application/octet-stream;
What methods/techniques are available in NSData to set Mime-Types and
other such things? Below is example of code I'm using with EDMessage.
NSString *text = @"Kevin Muldoon;Company;1-267-363-7401\r##\rMy fax
cover letter!\r##\r";
NSData *documentData =[NSData dataWithContentsOfFile:@"/Users/kevin/
Documents/example.pdf"];
NSMutableArray *attachmentList = [NSMutableArray array];
[attachmentList addObject:[EDObjectPair
pairWithObjects:documentData:@"example.pdf"]];
NSMutableDictionary * headerFields = [NSMutableDictionary dictionary];
[headerFields setObject:@"Kevin Muldoon <email@hidden>"
forKey:EDMailFrom];
[headerFields setObject:@"Center4Sight <email@hidden>"
forKey:EDMailTo];
[headerFields setObject:@"Hi there, with attachment..."
forKey:EDMailSubject];
EDMailAgent *mailAgent = [EDMailAgent
mailAgentForRelayHostWithName:@"mail.centerforsight.net" port:1234];
[mailAgent setUsesSecureConnections:NO];
[mailAgent sendMailWithHeaders:headerFields body:[text
stringWithCanonicalLinebreaks] andAttachments:attachmentList];
And here is the raw result of that email which fails...
--EDMessagePart-13136997390
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Content-Transfer-Encoding: 7bit
Kevin Muldoon;Company;1-267-363-7401
##
My fax cover letter!
##
--EDMessagePart-13136997390
Content-Type: application/octet-stream;
name=waitforit.pdf
Content-Transfer-Encoding: base64
Kevin Muldoon
e: email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden