Http://www.cocoachina.com/macdev/cocoa/2009/0611/255.html
Some readers mentioned the need to develop email programs on the iPhone a few days ago. In addition to sending emails using mailto, there are no other better methods in the iPhone SDK.
Here we will introduce two open source email codes based on objective-C. In theory, the code can be used in the iPhone after minor modifications, but note that the authorization methods of these two codes are important.
Pantomime
Is a complete framework for developing mail programs, and many Mac-based desktop programs use this framework. In terms of functions, it supports MIME encoding and decoding, fully supports IMAP and POP3 protocols, and supports sending local emails or sending via remote SMTP. It supports SSL/TLS secure sending and receiving mechanisms.
Most of its code is written in objective-C. Only a small part of the code that requires performance is written in C. In addition, it uses a little EML.
Code. It can be used for both Mac OSX and gnustep compiling.
Pantomime is very simple to use, and the download package also provides a complete example of use, only a short amount of code can be used to receive, send, password verification and other functions.
If you want to develop a complete email program, pantomime is the best choice. Here
The version is 1.2.0pre3.
The name of another code is mailcore framework.
Developed by Matt Ronge (I feel that many people who develop Mac are called Matt ......). It is also very easy to use and comes with two simple and clear examples.
Sending emails using mailcore framework is very simple:
- Ctcoremessage *
Testmsg =
[
[
Ctcoremessage alloc
]
Init
]
;
- [
Testmsg setto:
[
Nsset
Setwithobject
:
[
Ctcoreaddress addresswithname:
@ "Monkey"
Email:
@ Monkey@monkey.com"
]
]
]
;
- [
Testmsg setfrom:
[
Nsset
Setwithobject
:
[
Ctcoreaddress addresswithname:
@ "Someone"
Email:
@ Test@someone.com"
]
]
]
;
- [
Testmsg setbody:
@ "This Is A Test message! "
]
;
- [
Testmsg setsubject:
@ "This is a subject"
]
;
After setting, you can directly send the message:
- Ctsmtpconnection sendmessage:
Testmsg Server
:
@ "Mail.test.com"
Username:
@ "Test"
Password
:
@ "Test"
Port
:
25
Usetls:
Yes
Shouldauth:
Yes
]
;
- [
Testmsg release
]
;
Note that mailcore does not support multithreading. In addition, mailcore stores all information in the memory, so developers need to manually Save the code. However, it is still a very simple and easy-to-use email receiving and sending Code. It is recommended that you take a look at it.
Here is mailcore.
Including documents and examples.