मुझे इसमें भी रूचि थी, इसलिए दो दिनों के रिवर्स इंजीनियरिंग सफारीस 'इस पृष्ठ की मेल सामग्री' सुविधा और मुझे यह काम मिल गया।
अद्यतन: मैं कोड सुधार हुआ है और GitHub
- (void)mailWebArchive:(WebArchive *)webArchive title:(NSString *)aTitle URL:(NSString *)aURL {
NSString *bundleID = @"com.apple.mail";
NSData* targetBundleID = [bundleID dataUsingEncoding:NSUTF8StringEncoding];
NSAppleEventDescriptor *targetDescriptor = nil;
NSAppleEventDescriptor *appleEvent = nil;
targetDescriptor = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplicationBundleID
data:targetBundleID];
appleEvent = [NSAppleEventDescriptor appleEventWithEventClass:'mail'
eventID:'mlpg'
targetDescriptor:targetDescriptor
returnID:kAutoGenerateReturnID
transactionID:kAnyTransactionID];
[appleEvent setParamDescriptor:[NSAppleEventDescriptor descriptorWithDescriptorType:'tdta'
data:[webArchive data]]
forKeyword:'----'];
[appleEvent setParamDescriptor:[NSAppleEventDescriptor descriptorWithString:aTitle]
forKeyword:'urln'];
[appleEvent setParamDescriptor:[NSAppleEventDescriptor descriptorWithString:aURL]
forKeyword:'url '];
NSAppleEventDescriptor *replyDescriptor = nil;
NSAppleEventDescriptor *errorDescriptor = nil;
AEDesc reply = { typeNull, NULL };
// Send the AppleEvent
OSStatus status = AESendMessage([appleEvent aeDesc],
&reply,
kAEWaitReply,
kAEDefaultTimeout);
if(status == noErr)
{
replyDescriptor = [[[NSAppleEventDescriptor alloc] initWithAEDescNoCopy:&reply] autorelease];
errorDescriptor = [replyDescriptor paramDescriptorForKeyword:keyErrorNumber];
if(errorDescriptor != nil)
status = [errorDescriptor int32Value];
if(status != noErr)
NSLog(@"%s error %d", _cmd, status);
}
}
इस कोड पर डाल दिया है, तो मेल चल रहा है की जाँच नहीं करता, तो यह केवल जब वर्किंग मेल पहले से ही शुरू कर दिया गया है है।
इस दृष्टिकोण का समर्थक पक्ष यह मेलबॉक्स द्वारा समर्थित सभी मेल क्लाइंट्स के साथ काम करता है जो समर्थित और मेलपेज समर्थित है। QA1722 देखें।
नकारात्मकता यह है कि आप प्राप्तकर्ताओं को mailto
के साथ सेट नहीं कर सकते हैं। इसके लिए स्क्रिप्टिंग ब्रिज एकमात्र समाधान लगता है। यह संशोधित SBSendEmail sample देखें।
कुछ संसाधन: http://cocoaheads.byu.edu/resources/email –
इस मुद्दे पर कोई समाचार? –