开发者

How to send email from iPhone app without user interface

I want my app to be able to send an email with attachment to a hard-coded recipient with no u开发者_JAVA技巧ser input required, unlike the MessageUI framework.

Is there any way to do this? Any example code would be appreciated.

Thanks in advance.


Apple doesn't give you a way to do this. You'll have to write your own IMAP library or use a 3rd-party library (Mailcore is good).


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜