Skip to content

Instantly share code, notes, and snippets.

@ljanzik
Created June 1, 2012 11:27
Show Gist options
  • Save ljanzik/2851390 to your computer and use it in GitHub Desktop.
Save ljanzik/2851390 to your computer and use it in GitHub Desktop.
E-Mails versenden mit Phonegap: iOS
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);
}
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