Last active
December 27, 2015 03:59
-
-
Save kunal732/7264026 to your computer and use it in GitHub Desktop.
send email with sendgrid-obj library
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
//create Email Object | |
sendgrid *msg = [sendgrid user:@"ApiUser" andPass:@"ApiKey"]; | |
//set parameters | |
msg.subject = @"email subject"; | |
msg.tolist = @[@"[email protected]", @"[email protected]"]; | |
msg.from = @"[email protected]"; | |
msg.text = @"hello world"; | |
msg.html = @"<html><body><h1>hello world</h1></body></html>"; | |
//adding unique arguments (Optional) | |
NSDictionary *uarg = @{@"customerAccountNumber":@"55555", | |
@"activationAttempt": @"1"}; | |
[msg addCustomHeader:uarg withKey:@"unique_args"]; | |
//adding categories (Optional) | |
NSString *replyto = @"billing_notifications"; | |
[msg addCustomHeader:replyto withKey:@"category"]; | |
//Image attachment (Optional) | |
[msg attachImage:self.photo]; | |
//Send email through Web API Transport | |
[msg sendWithWeb]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment