Skip to content

Commit

Permalink
#5 Sending an email without the html property fails on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed May 24, 2016
1 parent fa9f1d9 commit a59ef71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Although the object is in the global scope, it is not available until after the

You need to create an account. Once completed use the folloiwng from cordova CLI to install the plugin:

cordova plugin add url --variable API_USER="SendGrid Username" --variable API_KEY=SendGrid Password
cordova plugin add url --variable API_USER="SendGrid Username" --variable API_KEY="SendGrid Password"

If you are using telerik AppBuilder then checkout the [plugins.telerik.com](http://plugins.telerik.com) for details on how to install it.

Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="com.telerik.sendgrid" version="1.0.7" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<plugin id="com.telerik.sendgrid" version="1.0.8" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">

<name>SendGrid</name>

Expand Down
8 changes: 7 additions & 1 deletion src/ios/SendGridEmail.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,15 @@ - (NSDictionary *)parametersDictionary:(NSString *)apiUser apiKey:(NSString *)ap
else if (self.to == nil)
[NSException raise:@"Missing to email value" format:@"to is: %@", self.to];

NSMutableDictionary *parameters =[NSMutableDictionary dictionaryWithDictionary:@{@"api_user": apiUser, @"api_key": apiKey, @"subject":self.subject, @"from":self.from, @"html":self.html,@"to":self.to, @"text":self.text, @"x-smtpapi":self.xsmtpapi}];
NSMutableDictionary *parameters =[NSMutableDictionary dictionaryWithDictionary:@{@"api_user": apiUser, @"api_key": apiKey, @"subject":self.subject, @"from":self.from, @"to":self.to, @"x-smtpapi":self.xsmtpapi}];

//optional parameters
if (self.html != nil)
[parameters setObject:self.html forKey:@"html"];

if (self.text != nil)
[parameters setObject:self.text forKey:@"text"];

if (self.bcc != nil)
[parameters setObject:self.bcc forKey:@"bcc"];

Expand Down

0 comments on commit a59ef71

Please sign in to comment.