How to attach PDF file In e-mail
MFMailComposeViewController *picker=[[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"PDF File"];
NSArray *toRecipients = [NSArray arrayWithObjects:@"abc@example.com",nil];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"def@example.com", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@"ghi@example.com"];
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
// Attach an pdf to the email
// if it is in your NSBundle Use the following two lines
NSString *path = [[NSBundle mainBundle] pathForResource:@"Attachment" ofType:@"pdf"]; NSData *myData = [NSData dataWithContentsOfFile:path]; [picker addAttachmentData:myData mimeType:@"pdf" fileName:@"Attachment.pdf"];
// if it is in user documents Use the following two lines of code
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString * path = [[paths lastObject] stringByAppendingPathComponent:@"Attachment.pdf"];
// Fill out the email body text
NSString *emailBody = @"A PDF File is attached.";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release]; // No need if you are using iOS5+
kuşadası
ReplyDeletemilas
çeşme
bağcılar
ordu
8MQ