我希望我的应用程序能够发送带有附件的电子邮件到硬编码的收件人,而不需要用户输入,这与MessageUI框架不同。
有没有办法做到这一点? 任何示例代码将不胜感激。
提前致谢。
I want my app to be able to send an email with attachment to a hard-coded recipient with no user input required, unlike the MessageUI framework.
Is there any way to do this? Any example code would be appreciated.
Thanks in advance.
最满意答案
正如Saurabh所说,没有低级邮件库。 我会寻找一个SMTP库,而不是一个IMAP,因为你不需要收到邮件,只是发送它。
附件可以通过MFMailComposeViewController来完成-(void)addAttachmentData:(NSData *)attachment mimeType:(NSString *)mimeType fileName:(NSString *)filename
我认为简单的base64编码数据,并附加一个mime类型的页眉和页脚。
看看这个主题的很多问题: 开源Cocoa / Cocoa-Touch POP3 / SMTP库?
As Saurabh said, there is no low level mail library. I would look for an SMTP library, rather than an IMAP one, because you don't need to get mail, just sent it.
Attachments can be done with MFMailComposeViewController's via -(void)addAttachmentData:(NSData *)attachment mimeType:(NSString *)mimeType fileName:(NSString *)filename
Which I believe simply base64 encodes the data, and attached a mime type header and footer.
Check out this question for lots on the topic: Open Source Cocoa/Cocoa-Touch POP3/SMTP library?
更多推荐
发布评论