SMTPAPI 0.2.0

SMTPAPI 0.2.0

测试测试过
语言语言 Obj-CObjective C
许可 MIT
发布最后发布2014年12月

Kunal BatraHeitor Tashiro Sergent 维护。



SMTPAPI 0.2.0

SMTPAPI for iOS

此模块将使您能够以简单的方式构建 SendGrid 的 SMTP API 标头。

安装

选择您的安装方法 - CocoaPods(推荐)或通过源代码。

Podfile

platform :ios, '7.0'
pod 'smtpapi', '~>  0.1.0'

在命令行中运行以下命令

pod install

请确保现在打开 xcworkspace 文件而不是 xcodeproj 文件。

然后导入库 - 在适合您项目的文件中。

import <SMTPAPI/SMTPAPI.h>

替代安装

通过源代码安装

1. Clone this repository.
2. Copy SMTPAPI.h and .m files to your project.
3. Import SMTPAPI.h in the file appropriate to your project.

示例

创建标头

import <SMTPAPI/SMTPAPI.h>

SMTPAPI *header = [SMTPAPI alloc] init];

收件人

[header addTo:@"[email protected]"];
// or
[header addTo:@[@"[email protected]"];
// or
[header setTos:@[@"[email protected]"]];

NSArray *tos = [header getTos];

替换标签

[header addSubstitution:@"key" val:@"value"];

NSMutableDictionary *subs = [header getSubstitutions];

唯一参数

[header addUniqueArg:@"key" val:@"value"];
// or
NSMutableDictionary *uniqueArgs = [[NSMutableDictionary alloc] init];
[uniqueArgs setObject:@"value" forKey:@"unique"];
[header setUniqueArgs:uniqueArgs];

NSMutableDictionary *args = [header getUniqueArgs];

分类

[header addCategory:@"category"];
// or
[header addCategories:@[@"category1", @"category2"]];
// or
[header setCategories:@[@"category1", @"category2"]];

NSMutableArray *cats = [header getCategories];

[header addSection:@"key" val:@"section"];
// or
NSMutableDictionary *newSec = [[NSMutableDictionary alloc] init];
[newSec setObject:@"value" forKey:@"-section-"];
[header setSections:newSec];

NSMutableDictionary *sections = [header getSections];

过滤器

[header addFilter:@"filter" setting:@"setting" val:@"value"];
[header addFilter:@"filter" settings:@"setting" val:1];

NSMutableDictionary *filters = [header getFilters];

获取标头

[header configureHeader];
NSString *headers = header.encodedHeader;

许可

基于 MIT 许可证。