SMTPAPI 0.2.0

SMTPAPI 0.2.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Kunal Batra, Heitor Tashiro Sergent.



SMTPAPI 0.2.0

SMTPAPI for iOS

This module will let you build SendGrid's SMTP API headers with simplicity.

Installing

Choose your installation method - CocoaPods (recommended) or via source.

Podfile

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

Run the following in the command line

pod install

Be sure to open up the xcworkspace file now instead of the xcodeproj file.

Then import the library - in the file appropriate to your project.

import <SMTPAPI/SMTPAPI.h>

Alternative installation

Install via Source

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.

Examples

Create headers

import <SMTPAPI/SMTPAPI.h>

SMTPAPI *header = [SMTPAPI alloc] init];

To

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

NSArray *tos = [header getTos];

Substitutions

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

NSMutableDictionary *subs = [header getSubstitutions];

Unique Arguments

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

NSMutableDictionary *args = [header getUniqueArgs];

Categories

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

NSMutableArray *cats = [header getCategories];

Sections

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

NSMutableDictionary *sections = [header getSections];

Filters

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

NSMutableDictionary *filters = [header getFilters];

Get Headers

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

License

Licensed under the MIT License.