Last active
December 31, 2023 19:14
-
-
Save sendpulse/95a758d2930397567d17 to your computer and use it in GitHub Desktop.
SendPulse REST API Usage Example for Objective-C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Sendpulse.h" // SendPulse's Obj-C Library https://github.com/sendpulse/sendpulse-rest-api-objective-c | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomethingWithTheData:) name:@"SendPulseNotification" object:nil]; | |
Sendpulse* sendpulse = [[Sendpulse alloc] initWithUserIdandSecret:userId :secret]; | |
NSDictionary *from = [NSDictionary dictionaryWithObjectsAndKeys:@"Your Sender Name", @"name", @"[email protected]", @"email", nil]; | |
NSMutableArray* to = [[NSMutableArray alloc] initWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"Subscriber's name", @"name", @"[email protected]", @"email", nil], nil]; | |
NSMutableDictionary *emaildata = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"<b>Your email content goes here</b>", @"html", @"Your email text version goes here", @"text",@"Testing SendPulse API",@"subject",from,@"from",to,@"to", nil]; | |
[sendpulse smtpSendMail:emaildata]; | |
} | |
- (void)doSomethingWithTheData:(NSNotification *)notification { | |
NSMutableDictionary * result = [[notification userInfo] objectForKey:@"SendPulseData"]; | |
NSLog(@"Result: %@",result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment