简体   繁体   English

无法从草稿发送附件(Mail.app)

[英]Can't send attachments from draft (Mail.app)

I am trying to send a draft created with Mail.app. 我正在尝试发送使用Mail.app创建的草稿。

As drafts have no send method, I'm having to get all the content from the draft, and create a new e-mail with it. 由于草稿没有发送方法,因此我必须从草稿中获取所有内容,并使用它创建新的电子邮件。 That should be ok, but... Attachments aren't getting through. 没关系,但是...附件没有通过。

I am using this: 我正在使用这个:

outgoing.content = message.content;

Where outgoing is the message I am creating and message is the draft I am reading from. 我正在创建的消息是传出消息,而我正在阅读的消息是消息。

I tried looping through the attachments of the message and adding them manually but I always get this: 我尝试遍历消息的附件并手动添加它们,但是我总是这样:

*** -[SBElementArray addObject:]: can't add an object that already exists.

This is how I am looping through them: 这就是我遍历它们的方式:

for (int i=0; i<[message.content.attachments count]; i++) {
            MailAttachment *anAttachment = [message.content.attachments objectAtIndex:i];
            if (![outgoing.content.attachments containsObject:anAttachment]) {
                NSLog(@"File Path: %@", anAttachment.fileName);
                MailAttachment *newAttachment = anAttachment;
                [outgoing.content.attachments addObject:newAttachment];
            }
}

It should be worth noting that the File Path NSLog always comes out as (null), no matter what. 值得注意的是,无论如何,文件路径NSLog总是以(null)出现。

Would appreciate any help here. 希望在这里有任何帮助。

根据我的研究,在阅读消息和获取其内容时,Mail.app的AppleScript / ScriptingBridge API几乎被破坏了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM