Created
June 1, 2012 11:27
-
-
Save ljanzik/2851390 to your computer and use it in GitHub Desktop.
E-Mails versenden mit Phonegap: iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EmailComposer.prototype.showEmailComposer = function(subject,body,toRecipients,ccRecipients,bccRecipients,bIsHTML,attachment) { | |
| var args = {}; | |
| if(toRecipients) | |
| args.toRecipients = toRecipients; | |
| if(ccRecipients) | |
| args.ccRecipients = ccRecipients; | |
| if(bccRecipients) | |
| args.bccRecipients = bccRecipients; | |
| if(subject) | |
| args.subject = subject; | |
| if(body) | |
| args.body = body; | |
| if(bIsHTML) | |
| args.bIsHTML = bIsHTML; | |
| if(attachment) | |
| args.attachment = attachment; | |
| PhoneGap.exec("com.phonegap.emailComposer.showEmailComposer",args); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSString* attachmentPath = [options valueForKey:@"attachment"]; | |
| if (attachmentPath != nil) { | |
| NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
| NSString *documentsDirectory = [paths objectAtIndex:0]; | |
| NSString *filePath = [documentsDirectory stringByAppendingPathComponent:attachmentPath]; | |
| NSData *data = [NSData dataWithContentsOfFile:filePath]; | |
| [picker addAttachmentData:data mimeType:@"text/csv" fileName:attachmentPath]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment