Latest 0.2.0
Homepage https://github.com/sendgrid/smtpapi-objc
License MIT
Platforms ios 7.0, requires ARC
Authors

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.

CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SendGrid and its dependencies in your projects. Simply add the lines below to your existing Podfile or make a new ‘Podfile’ that contain the lines below.

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.

Latest podspec

{
    "name": "SMTPAPI",
    "version": "0.2.0",
    "summary": "Simple Wrapper around SendGrid SMTPAPI Header",
    "description": "                       This module will let you build SendGrid's SMTP API headers with simplicity.n",
    "homepage": "https://github.com/sendgrid/smtpapi-objc",
    "license": "MIT",
    "authors": {
        "Heitor Tashiro Sergent": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sendgrid/smtpapi-objc.git",
        "tag": "0.2.0"
    },
    "social_media_url": "https://twitter.com/heitortsergent",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "SMTPAPI"
}

Pin It on Pinterest

Share This