正如您所知,skpsmtpmessage
不能以并发顺序发送电子邮件。《MailUtil》是一种将skpsmtpmessage
封装起来以顺序发送电子邮件的工具。感谢使用GCD顺序发送电子邮件的文章。
要运行示例项目,首先从仓库克隆,然后在示例目录中运行pod install
。
iOS7+
MailUtil可通过CocoaPods获取。要安装它,只需将以下行添加到Podfile中
pod "MailUtil", :git => 'https://github.com/troyz/MailUtil.git', :tag => '0.1.0'
// please correct it.
[SendEmailOperation setupConfigWithServer:@"smtp.163.com" withFrom:@"[email protected]" withLogin:@"[email protected]" withPassword:@"**********"];
// the attachment file path
NSString *path = [[NSBundle mainBundle] pathForResource:@"[email protected]" ofType:nil];
// a message that will be sent
SendEmailOperation *operation = [[SendEmailOperation alloc] initWithTo:@"[email protected]" subject:@"Hello" body:@"World" path:path];
// send the message
[SendEmailOperation sendEmail:operation];
张 Troy, [email protected]
MailUtil可在MIT许可下使用。查看LICENSE文件了解更多信息。