如何从没有用户界面的iPhone应用程序发送电子邮件(How to send email from iPhone app without user interface)

系统教程 行业动态 更新时间:2024-06-14 17:01:34
如何从没有用户界面的iPhone应用程序发送电子邮件(How to send email from iPhone app without user interface)

我希望我的应用程序能够发送带有附件的电子邮件到硬编码的收件人,而不需要用户输入,这与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?

更多推荐

本文发布于:2023-04-20 18:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/1fb3e4011f5aa7f3210f9090f7d7b25f.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户界面   应用程序   从没   发送电子邮件   iPhone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!