Email Service Management can be used by the app to configure host email account and send emails to one or multiple recipients. Developers can create and manage templates for sending mails as well. This module is also used in launching Email Campaigns through App42 Marketing Automation.
import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.email.Email; import com.shephertz.app42.paas.sdk.android.email.EmailMIME; import com.shephertz.app42.paas.sdk.android.email.EmailService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.email;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"import com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.email.Email; import com.shephertz.app42.paas.sdk.java.email.EmailMIME; import com.shephertz.app42.paas.sdk.java.email.EmailService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.email;<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>local App42API = require("App42-Lua-API.App42API")#include "App42API.h"using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.email;include_once '../EmailService.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php';#include "App42API.h"require 'App42_Ruby_API'import com.shephertz.app42.paas.sdk.as3.App42CallBack; import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.email.Configuration; import com.shephertz.app42.paas.sdk.as3.email.Email; import com.shephertz.app42.paas.sdk.as3.email.EmailService;Coming Soonimport com.shephertz.app42.paas.sdk.jme.App42API; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.email.Email; import com.shephertz.app42.paas.sdk.jme.email.EmailMIME; import com.shephertz.app42.paas.sdk.jme.email.EmailService;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");App42API:initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of EmailService, buildEmailService() method needs to be called.
EmailService emailService = App42API.buildEmailService();EmailService emailService = App42API.BuildEmailService();EmailService *emailService = [App42API buildEmailService];let emailService = App42API.buildEmailService() as? EmailServiceEmailService emailService = App42API.buildEmailService();EmailService emailService = App42API.BuildEmailService();var emailService = new App42Email();local emailService = App42API:buildEmailService()EmailService *emailService = App42API::BuildEmailService();EmailService emailService = App42API.BuildEmailService();$emailService = App42API::buildEmailService();EmailService *emailService = App42API::BuildEmailService();email_service = api.build_email_service()var emailService:EmailService = App42API.buildEmailService();Coming SoonEmailService emailService = App42API.buildEmailService();
Create Email Configuration using which in future the developer can send mails.
Required Parameters
emailHost - Email Host to be used for sending mails.
emailPort - Email Port to be used for sending mails.
emailId - Email ID to be used for sending mails.
password - Email Password to be used for sending mails.
isSSL - Should be sent using SSL or not.
String emailHost = "smtp.gmail.com"; int emailPort = 465; String emailId = "nick@gmail.com"; String password = "********"; boolean isSSL = true; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.createMailConfiguration(emailHost, emailPort,emailId, password, isSSL, new App42CallBack() { public void onSuccess(Object response) { Email email = (Email)response; ArrayList<Email.Configuration> configList = email.getConfigList(); for(Email.Configuration config : configList) { System.out.println("emailId is " + config.getEmailId()); System.out.println("Host is " + config.getHost()); System.out.println("Port is " + config.getPort()); System.out.println("SSL is " + config.getSsl()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String emailHost = "smtp.gmail.com"; int emailPort = 465; String emailId = "nick@gmail.com"; String password = "********"; boolean isSSL = true; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.CreateMailConfiguration(emailHost,emailPort,emailId,password,isSSL,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Email email = (Email) response; Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId()); Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost()); String jsonResponse = email.ToString(); } }NSString *emailHost = @"smtp.gmail.com"; int *emailPort = 465; NSString *emailId = @"nick@gmail.com"; NSString *password = @"********"; BOOL isSSL = true; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; EmailService *emailService = [App42API buildEmailService]; [emailService createEmailConfiguration:emailHost emailPort:emailPort emailId:emailId emailPassword:password isSSL:isSSL completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Email *email = (Email*)responseObj; NSMutableArray *configurationArray = email.configurationArray; for(Configurations *configuration in configurationArray) { NSLog(@"emailId is %@" , configuration.emailId); NSLog(@"Host is %@" , configuration.host); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let emailHost = "smtp.gmail.com" let emailPort:Int32 = 465 let emailId = "nick@gmail.com" let password = "********" let isSSL = true App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let emailService = App42API.buildEmailService() as? EmailService emailService?.createEmailConfiguration(emailHost, emailPort:emailPort, emailId:emailId, emailPassword:password, isSSL:isSSL, completionBlock:{ (success, responseObj, exception) if (success) { let email = response as! Email var configurationArray = email.configurationArray for configuration in configurationArray { let config = configuration as! Configurations NSLog("%@" , config.emailId) NSLog("%@" , config.host) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String emailHost = "smtp.gmail.com"; int emailPort = 465; String emailId = "nick@gmail.com"; String password = "********"; boolean isSSL = true; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); Email email = emailService.createMailConfiguration(emailHost,emailPort,emailId,password,isSSL); ArrayList<Email.Configuration> configList = email.getConfigList(); for(Email.Configuration config : configList) { System.out.println("emailId is " + config.getEmailId()); System.out.println("Host is " + config.getHost()); System.out.println("Port is " + config.getPort()); System.out.println("SSL is " + config.getSsl()); } String jsonResponse = email.toString();`String emailHost = "smtp.gmail.com"; int emailPort = 465; String emailId = "nick@gmail.com"; String password = "********"; boolean isSSL = true; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.CreateMailConfiguration(emailHost,emailPort,emailId,password,isSSL, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var emailHost = "smtp.gmail.com", emailPort = 465, emailId = "nick@gmail.com", password = "********", isSSL = true, result ; App42.initialize("API_KEY","SECRET_KEY"); var emailService = new App42Email(); emailService.createMailConfiguration(emailHost,emailPort,emailId,password,isSSL,{ success: function(object) { var email = JSON.parse(object); result = email.app42.response.email.configurations.config; console.log("Email id is " + result.emailId); console.log("Host is " + result.host); console.log("Port is " + result.port); console.log("Ssl is " + result.ssl); }, error: function(error) { } });local emailHost = "smtp.gmail.com" local emailPort = 465 local emailId = "nick@gmail.com" local password = "********" local isSSL = true local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local emailService = App42API:buildEmailService() emailService:createMailConfiguration(emailHost, emailPort,emailId, password ,isSSL, App42CallBack) function App42CallBack:onSuccess(object) print("emailId is "..object:getConfigList():getEmailId()) print("Host is " ..object:getConfigList():getHost()); print("Port is "..object:getConfigList():getPort()); print(object:getConfigList():getSsl()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endstring emailHost = "smtp.gmail.com"; int emailPort = 465; string emailId = "nick@gmail.com"; string password = "********"; bool isSSL = true; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->createMailConfiguration(emailHost.c_str(), emailPort, emailId.c_str(), password.c_str(), isSSL, app42callback(Sample_Class::onEmailRequestCompleted, this)); void Sample_Class::onEmailRequestCompleted(void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it) { printf("\n EmailId=%s",it->emailId.c_str()); printf("\n Host=%s",it->host.c_str()); printf("\n Port=%d",it->port); printf("\n SSL=%d",it->ssl); } } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }String emailHost = "smtp.gmail.com"; int emailPort = 465; String emailId = "nick@gmail.com"; String password = "********"; boolean isSSL = true; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); Email email = emailService.CreateMailConfiguration(emailHost,emailPort,emailId,password,isSSL); Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId()); Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost()); String jsonResponse = email.ToString();$emailHost = "smtp.gmail.com"; $emailPort = 465; $emailId = "nick@gmail.com"; $password = "********"; $isSSL = "true"; App42API::initialize("API_KEY","SECRET_KEY"); $emailService = App42API::buildEmailService(); $email = $emailService->createMailConfiguration($emailHost, $emailPort, $emailId,$password,$isSSL); $configList = $email->getConfigList(); foreach($configList as $config) { print_r("emailId is " . $config->getEmailId()); print_r("Host is " . $config->getHost()); print_r("Port is " . $config->getPort()); print_r("SSL is " . $config->getSsl()); } $jsonResponse = $email->toString();string emailHost = "smtp.gmail.com"; int emailPort = 465; string emailId = "nick@gmail.com"; string password = "********"; bool isSSL = true; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->createMailConfiguration(emailHost.c_str(), emailPort, emailId.c_str(), password.c_str(), isSSL, this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted)); void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it) { printf("\n EmailId=%s",it->emailId.c_str()); printf("\n Host=%s",it->host.c_str()); printf("\n Port=%d",it->port); printf("\n SSL=%d",it->ssl); } } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }emailHost = "smtp.gmail.com"; emailPort = 465; emailId = "nick@gmail.com"; password = "********"; isSSL = true; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") email_service = api.build_email_service() email = email_service.create_mail_configuration(emailHost,emailPort,emailId,password,isSSL); config_list = Array.new(); config_list = email.config_list(); for config in config_list do puts "emailId is #{config.emailId}"; puts "host is #{config.emailHost}"; puts "port is #{config.emailPort}"; end json_response = email.to_s();var emailHost:String = "smtp.gmail.com"; var emailPort:int = 465; var emailId:String = "nick@gmail.com"; var password:String = "********"; var isSSL:Boolean = true; App42API.initialize("API_KEY","SECRET_KEY"); var emailService:EmailService = App42API.buildEmailService(); emailService.createMailConfiguration(emailHost, emailPort, emailId, password, isSSL,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var emailObject:Email = Email(response); var configList:Array = emailObject.getConfigList(); for(var i:int=0;i<configList.length;i++){ trace("EmailId is : " + Configuration(configList[i]).getEmailId()); trace("Host is : " + Configuration(configList[i]).getHost()); trace("SSL is : " + Configuration(configList[i]).getSsl()); trace("Port is : " + Configuration(configList[i]).getPort()); } } }Coming SoonString emailHost = "smtp.gmail.com"; int emailPort = 465; String emailId = "nick@gmail.com"; String password = "********"; boolean isSSL = true; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); Email email = emailService.createMailConfiguration(emailHost,emailPort,emailId,password,isSSL); System.out.println("emailId is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getEmailId()); System.out.println("Host is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getHost()); String jsonResponse = email.toString();
Get all Email Configurations for the app.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.getEmailConfigurations(new App42CallBack() { public void onSuccess(Object response) { Email email = (Email)response; ArrayList<Email.Configuration> configList = email.getConfigList(); for(Email.Configuration config : configList) { System.out.println("emailId is " + config.getEmailId()); System.out.println("Host is " + config.getHost()); System.out.println("Port is " + config.getPort()); System.out.println("SSL is " + config.getSsl()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.GetEmailConfigurations(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Email email = (Email) response; Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId()); Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost()); String jsonResponse = email.ToString(); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; EmailService *emailService = [App42API buildEmailService]; [emailService getEmailConfiguration:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Email *email = (Email*)responseObj; NSMutableArray *configurationArray = email.configurationArray; for(Configurations *configuration in configurationArray) { NSLog(@"emailId is %@" , configuration.emailId); NSLog(@"Host is %@" , configuration.host); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let emailService = App42API.buildEmailService() as? EmailService emailService?.getEmailConfiguration({ (success, response, exception) -> Void in if(success) { let email = response as! Email let configurationArray = email.configurationArray for configuration in configurationArray { let config = configuration as! Configurations NSLog("%@",config.emailId) NSLog("%@",config.host) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); Email email = emailService.getEmailConfigurations(); ArrayList<Email.Configuration> configList = email.getConfigList(); for(Email.Configuration config : configList) { System.out.println("emailId is " + config.getEmailId()); System.out.println("Host is " + config.getHost()); System.out.println("Port is " + config.getPort()); System.out.println("SSL is " + config.getSsl()); } String jsonResponse = email.toString();`App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.getEmailConfigurations(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result ; App42.initialize("API_KEY","SECRET_KEY"); var emailService = new App42Email(); emailService.getEmailConfigurations({ success: function(object) { var email = JSON.parse(object); result = email.app42.response.email.configurations.config; if (result instanceof Array) { for (var i = 0; i < result.length; i++) { console.log("Email id is " + result[i].emailId); console.log("Host is " + result[i].host); console.log("Port is " + result[i].port); console.log("Ssl is " + result[i].ssl); } } else { console.log("Email id is " + result.emailId); console.log("Host is " + result.host); console.log("Port is " + result.port); console.log("Ssl is " + result.ssl); } }, error: function(error) { } });local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local emailService = App42API:buildEmailService() emailService:getEmailConfigurations(App42CallBack) function App42CallBack:onSuccess(object)); if table.getn(object:getConfigList()) >1 then for m=1,table.getn(object:getConfigList()) do print("emailId is "..object:getConfigList()[m]:getEmailId()) print("Host is " .. object:getConfigList()[m]:getHost()); print("Port is "..object:getConfigList()[m]:getPort()); print(object:getConfigList()[m]:getSsl()); end else print("emailId is "..object:getConfigList():getEmailId()) print("Host is " ..object:getConfigList():getHost()); print("Port is "..object:getConfigList():getPort()); print(object:getConfigList():getSsl()); end end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endApp42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->getEmailConfigurations(app42callback(Sample_Class::onEmailRequestCompleted, this)); void Sample_Class::onEmailRequestCompleted(void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it) { printf("\n EmailId=%s",it->emailId.c_str()); printf("\n Host=%s\n",it->host.c_str()); printf("\n Port=%d\n",it->port); printf("\n SSL=%d\n",it->ssl); } } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); Email email = emailService.getEmailConfigurations(); Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId()); Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost()); String jsonResponse = email.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $emailService = App42API::buildEmailService(); $email = $emailService->getEmailConfigurations(); $configList = $email->getConfigList(); foreach($configList as $config) { print_r("emailId is " . $config->getEmailId()); print_r("Host is " . $config->getHost()); print_r("Port is " . $config->getPort()); print_r("SSL is " . $config->getSsl()); } $jsonResponse = $email->toString();App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->getEmailConfigurations(this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted)); void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it) { printf("\n EmailId=%s",it->emailId.c_str()); printf("\n Host=%s\n",it->host.c_str()); printf("\n Port=%d\n",it->port); printf("\n SSL=%d\n",it->ssl); } } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") email_service = api.build_email_service() email = email_service.get_email_configurations(); config_list = Array.new(); config_list = email.config_list(); for config in config_list do puts "emailId is #{config.email_id}"; puts "host is #{config.host}"; puts "port is #{config.port}"; end json_response = email.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var emailService:EmailService = App42API.buildEmailService(); emailService.getEmailConfigurations(new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var emailObject:Email = Email(response); var configList:Array = emailObject.getConfigList(); for(var i:int=0;i<configList.length;i++){ trace("EmailId is : " + Configuration(configList[i]).getEmailId()); trace("Host is : " + Configuration(configList[i]).getHost()); trace("SSL is : " + Configuration(configList[i]).getSsl()); trace("Port is : " + Configuration(configList[i]).getPort()); } } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); Email email = emailService.getEmailConfigurations(); System.out.println("emailId is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getEmailId()); System.out.println("Host is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getHost()); String jsonResponse = email.toString();
Send the email to user to whom you want to send, email will be sent from configuration that you have created.
Required Parameters
senderEmailId - The Email ID using which the mail has to be sent.
sendTo - The email IDs to which the email has to be sent. Email can be sent to multiple email IDs. Multiple email ids can be passed using comma as the separator. For example support@shephertz.com, info@shephertz.com.
sendSubject - Subject of the Email which to be sent.
sendMsg - Email body which has to be sent.
emailMime - MIME Type to be used for sending mail. EmailMime available options are PLAIN_TEXT_MIME_TYPE or HTML_TEXT_MIME_TYPE.
String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE, new App42CallBack() { public void onSuccess(Object response) { Email emailObject = (Email)response; System.out.println("Email From is : " +emailObject.getFrom()); System.out.println("email To is : " +emailObject.getTo()); System.out.println("Subject is : " + emailObject.getSubject()); System.out.println("Message Body is : " + emailObject.getBody()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Email email = (Email) response; Console.WriteLine("emailId is " + email.GetFrom()); Console.WriteLine("subject is " + email.GetSubject()); String jsonResponse = email.ToString(); } }NSString *sendTo = @"john@shephertz.co.in"; NSString *sendSubject = @"Feedback"; NSString *sendMsg = @"Your message"; NSString *senderEmailId = @"nick@gmail.com"; NSString *emailMime = @"EmailMIME.PLAIN_TEXT_MIME_TYPE"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; EmailService *emailService = [App42API buildEmailService]; [emailService sendMail:sendTo subject:sendSubject Message:sendMsg fromEmail:senderEmailId emailMIME:emailMime completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Email *email = (Email*)responseObj; NSLog(@"From is %@" , email.from); NSLog(@"To is %@" , email.to); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let sendTo = "john@shephertz.co.in" let sendSubject = "Feedback" let sendMsg = "Your message" let senderEmailId = "nick@gmail.com" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let emailService = App42API.buildEmailService() as? EmailService emailService?.sendMail(sendTo, subject:sendSubject, message:sendMsg, fromEmail:senderEmailId, emailMIME:PLAIN_TEXT_MIME_TYPE, completionBlock: { (success, response, exception) -> Void in if (success) { let email = response as! Email NSLog("%@" , email.to) NSLog("%@" , email.from) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); Email emailObject = emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId,emailMime); System.out.println("Email From is : " +emailObject.getFrom()); System.out.println("email To is : " +emailObject.getTo()); System.out.println("Subject is : " + emailObject.getSubject()); System.out.println("Message Body is : " + emailObject.getBody()); String jsonResponse = emailObject.toString();`String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var sendTo = "john@shephertz.co.in", senderEmailId = "nick@gmail.com", sendSubject = "Feedback", sendMsg = "Your message", result; App42.initialize("API_KEY","SECRET_KEY"); var emailService = new App42Email(); emailService.sendMail(sendTo,sendSubject,sendMsg,senderEmailId,"text/plain",{ success: function(object) { var email = JSON.parse(object); result =email.app42.response.email; console.log("email message " + result.body); console.log("from id " + result.from); console.log("subject " + result.subject); console.log("to id" + result.to); }, error: function(error) { } });local sendTo = "john@shephertz.co.in"; local senderEmailId = "nick@gmail.com"; local sendSubject = "Feedback"; local sendMsg = "Your message"; local App42CallBack = {} require("App42-Lua-API.EmailMIME") App42API:initialize("API_KEY","SECRET_KEY") local emailService = App42API:buildEmailService() emailService:sendMail(sendTo,sendSubject, sendMsg, emailId, EmailMIME.PLAIN_TEXT_MIME_TYPE,App42CallBack) function App42CallBack:onSuccess(object) print("Email From is : " ..object:getFrom()); print("email To is : " ..object:getTo()); print("Subject is : " ..object:getSubject()); print("Message Body is : "..object:getBody()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endstring sendTo = "john@shephertz.co.in"; string senderEmailId = "nick@gmail.com"; string sendSubject = "Feedback"; string sendMsg = "Your message"; EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,app42callback(Sample_Class::onEmailRequestCompleted, this)); void Sample_Class::onEmailRequestCompleted(void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { printf("\n From=%s",emailResponse->from.c_str()); printf("\n To=%s",emailResponse->to.c_str()); printf("\n Subject=%s",emailResponse->subject.c_str()); printf("\n Body=%s",emailResponse->body.c_str()); } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); Email email = emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime); Console.WriteLine("emailId is " + email.GetFrom()); Console.WriteLine("Host is " + email.GetSubject()); String jsonResponse = email.ToString();$sendTo = "john@shephertz.co.in"; $sendSubject = "Feedback"; $sendMsg = "Your message"; $senderEmailId = "nick@gmail.com"; $emailMime = EmailMIME::PLAIN_TEXT_MIME_TYPE; App42API::initialize("API_KEY","SECRET_KEY"); $emailService = App42API::buildEmailService(); $email = $emailService->sendMail($senderEmailId, $sendTo, $sendSubject, $sendMsg, $emailMime); print_r("Email From is : " .$email->getFrom()); print_r("email To is : " .$email->getTo()); print_r("Subject is : " .$email->getSubject()); print_r("Message Body is : " .$email->getBody()); $jsonResponse = $email->toString();string sendTo = "john@shephertz.co.in"; string senderEmailId = "nick@gmail.com"; string sendSubject = "Feedback"; string sendMsg = "Your message"; EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted)); void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { printf("\n From=%s",emailResponse->from.c_str()); printf("\n To=%s",emailResponse->to.c_str()); printf("\n Subject=%s",emailResponse->subject.c_str()); printf("\n Body=%s",emailResponse->body.c_str()); } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }sendTo = "john@shephertz.co.in"; sendSubject = "Here we are sending an Email"; sendMsg = "Body of message"; senderEmailId = "nick@gmail.com"; emailMime = App42::Email::EmailMIME.new(); email_mime_type = emailMime.enum("PLAIN_TEXT_MIME_TYPE"); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") email_service = api.build_email_service() email = email_service.send_mail(sendTo, sendSubject, sendMsg, senderEmailId, email_mime_type); puts "from #{email.from}"; puts "to #{email.to}"; puts "subject is #{email.subject}"; puts "body #{email.body}"; json_response = email.to_s();var sendTo:String = "john@shephertz.co.in"; var sendSubject:String = "Feedback"; var sendMsg:String = "Your message"; var senderEmailId:String = "nick@gmail.com"; var emailMime:String="EmailMIME.PLAIN_TEXT_MIME_TYPE"; App42API.initialize("API_KEY","SECRET_KEY"); var emailService:EmailService = App42API.buildEmailService(); emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId,emailMime ,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var emailObject:Email = Email(response); trace("Email From is : " +emailObject.getFrom()); trace("email To is : " +emailObject.getTo()); trace("Subject is : " + emailObject.getSubject()); trace("Message Body is : " + emailObject.getBody()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonString sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; EmailMIME emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); Email email = emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE); System.out.println("emailId is " + email.getFrom()); System.out.println("subject is " + email.getSubject()); String jsonResponse = email.toString();
Removes the email configuration for the given email ID which you have configured
Note: In future the developer won’t be able to send mails through this ID.
Required Parameters
emailId - The email ID for which the configuration has to be removed.
String emailId = "nick@gmail.com"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.removeEmailConfiguration( emailId, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String emailId = "nick@gmail.com"; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.RemoveEmailConfiguration(emailId, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }NSString *emailId = @"nick@gmail.com"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; EmailService *emailService = [App42API buildEmailService]; [emailService removeEmailConfiguration:emailId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let emailId = "nick@gmail.com" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let emailService = App42API.buildEmailService() as? EmailService emailService?.removeEmailConfiguration(emailId, completionBlock: { (success, response, exception) -> Void in if (success) { let response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String emailId = "nick@gmail.com"; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); App42Response app42response = emailService.removeEmailConfiguration(emailId); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();`String emailId = "nick@gmail.com"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.RemoveEmailConfiguration(emailId,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var emailId = "nick@gmail.com", result; App42.initialize("API_KEY","SECRET_KEY"); var emailService = new App42Email(); emailService.removeEmailConfiguration(emailId,{ success: function(object) { var email = JSON.parse(object); result = email.app42.response.email.configurations.config; console.log("Email id is " + result.emailId); console.log("Host is " + result.host); console.log("Port is " + result.port); console.log("Ssl is " + result.ssl); }, error: function(error) { } });local emailId = "nick@gmail.com"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local emailService = App42API:buildEmailService() emailService:removeEmailConfiguration(emailId,App42CallBack) function App42CallBack:onSuccess(object) print("Response is "..object:getStrResponse()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endstring emailId = "nick@gmail.com"; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->removeEmailConfiguration(emailId.c_str(),app42callback(Sample_Class::onEmailRequestCompleted, this)); void Sample_Class::onEmailRequestCompleted(void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it) { printf("\n EmailId=%s",it->emailId.c_str()); printf("\n Host=%s\n",it->host.c_str()); printf("\n Port=%d\n",it->port); printf("\n SSL=%d\n",it->ssl); } } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }String emailId = "nick@gmail.com"; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); App42Response response = emailService.RemoveEmailConfiguration(emailId); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$emailId = "nick@gmail.com"; App42API::initialize("API_KEY","SECRET_KEY"); $emailService = App42API::buildEmailService(); $response = $emailService->removeEmailConfiguration($emailId); print_r("Response is : ". $response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();string emailId = "nick@gmail.com"; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->removeEmailConfiguration(emailId.c_str(),this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted)); void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it) { printf("\n EmailId=%s",it->emailId.c_str()); printf("\n Host=%s\n",it->host.c_str()); printf("\n Port=%d\n",it->port); printf("\n SSL=%d\n",it->ssl); } } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }emailId = "nick@gmail.com"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") email_service = api.build_email_service() response = email_service.remove_email_configuration(emailId); success = response.is_response_success(); json_response = email.to_s();var emailId:String = "nick@gmail.com"; App42API.initialize("API_KEY","SECRET_KEY"); var emailService:EmailService = App42API.buildEmailService(); emailService.removeEmailConfiguration(emailId,new callback()); class callback implements App42CallBack{ public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonString emailId = "nick@gmail.com"; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); App42Response response = emailService.removeEmailConfiguration(emailId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Send the email to user to whom you want to send, email will be sent from configuration that you have created.
Required Parameters
senderEmailId - The Email ID using which the mail has to be sent.
sendTo - The email IDs to which the email has to be sent. Email can be sent to multiple email IDs. Multiple email IDs can be passed using comma as the separator. For example support@shephertz.com, info@shephertz.com.
sendSubject - Subject of the Email which to be sent.
sendMsg - Email body which has to be sent.
emailMime - MIME Type to be used for sending mail. EmailMime available options are PLAIN_TEXT_MIME_TYPE or HTML_TEXT_MIME_TYPE.
String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("template", "Your Template Name");//Which you are created from AppHQ. App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.setOtherMetaHeaders(otherMetaHeaders); emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE, new App42CallBack() { public void onSuccess(Object response) { Email emailObject = (Email)response; System.out.println("Email From is : " +emailObject.getFrom()); System.out.println("email To is : " +emailObject.getTo()); System.out.println("Subject is : " + emailObject.getSubject()); System.out.println("Message Body is : " + emailObject.getBody()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("template", "Your Template Name");//Which you are created from AppHQ. App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.SetOtherMetaHeaders(otherMetaHeaders); emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Email email = (Email) response; Console.WriteLine("emailId is " + email.GetFrom()); Console.WriteLine("subject is " + email.GetSubject()); String jsonResponse = email.ToString(); } }NSString *sendTo = @"john@shephertz.co.in"; NSString *sendSubject = @"Feedback"; NSString *sendMsg = @"Your message"; NSString *senderEmailId = @"nick@gmail.com"; NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Your Template Name",@"template", nil];//Which you are created from AppHQ. [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; EmailService *emailService = [App42API buildEmailService]; [emailService setOtherMetaHeaders:otherMetaHeaders]; [emailService sendMail:sendTo subject:sendSubject Message:sendMsg fromEmail:senderEmailId emailMIME:PLAIN_TEXT_MIME_TYPE completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Email *email = (Email*)responseObj; NSLog(@"from is %@" , email.from); NSLog(@"to is %@" , email.to); NSString jsonResponse = [email toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let sendTo = "john@shephertz.co.in" let sendSubject = "Feedback" let sendMsg = "Your message" let senderEmailId = "nick@gmail.com" let otherMetaHeaders = NSMutableDictionary(object:"Your Template Name", forKey:"template") App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let emailService = App42API.buildEmailService() as? EmailService emailService?.sendMail(sendTo, subject:sendSubject, message:sendMsg, fromEmail:senderEmailId, emailMIME:PLAIN_TEXT_MIME_TYPE, completionBlock: { (success, response, exception) ->Void in if (success) { let email = response as! Email NSLog("%@" , email.from) NSLog("%@" , email.to) NSLog("%@" , email.strResponse) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("template", "Your Template Name");//Which you are created from AppHQ. App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.setOtherMetaHeaders(otherMetaHeaders); Email emailObject = emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId,emailMime); System.out.println("Email From is : " +emailObject.getFrom()); System.out.println("email To is : " +emailObject.getTo()); System.out.println("Subject is : " + emailObject.getSubject()); System.out.println("Message Body is : " + emailObject.getBody()); String jsonResponse = emailObject.toString();`String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; App42Log.SetDebug(true); //Print output in your editor console Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("template", "Your Template Name");//Which you are created from AppHQ. App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.SetOtherMetaHeaders(otherMetaHeaders); emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var sendTo = "john@shephertz.co.in", senderEmailId = "nick@gmail.com", sendSubject = "Feedback", sendMsg = "Your message", result; var otherMetaHeaders = {"template":"Your Template Name"}; //Which you are created from AppHQ. App42.initialize("API_KEY","SECRET_KEY"); var emailService = new App42Email(); emailService.setOtherMetaHeaders(otherMetaHeaders); emailService.sendMail(sendTo,sendSubject,sendMsg,senderEmailId,"text/plain",{ success: function(object) { var email = JSON.parse(object); result =email.app42.response.email; console.log("email message" + result.body); console.log("from id " + result.from); console.log("subject " + result.subject); console.log("to id" + result.to); }, error: function(error) { } });local sendTo = "john@shephertz.co.in"; local senderEmailId = "nick@gmail.com"; local sendSubject = "Feedback"; local sendMsg = "Your message"; local App42CallBack = {} require("App42-Lua-API.EmailMIME") local otherMetaHeaders = {}; otherMetaHeaders.template= "Your Template Name";//Which you are created from AppHQ. App42API:initialize("API_KEY","SECRET_KEY") local emailService = App42API:buildEmailService() emailService:setOtherMetaHeaders(otherMetaHeaders); emailService:sendMail(sendTo,sendSubject, sendMsg, emailId, EmailMIME.PLAIN_TEXT_MIME_TYPE,App42CallBack) function App42CallBack:onSuccess(object) print("Email From is : " ..object:getFrom()); print("email To is : " ..object:getTo()); print("Subject is : " ..object:getSubject()); print("Message Body is : "..object:getBody()); end function App42CallBack:onException(object) print("Message is "..object:getAppErrorCode()); print("Message is "..object:getHttpErrorCode()); print("Message is "..object:getMessage()); print("Message is "..object:getDetails()); endstring sendTo = "john@shephertz.co.in"; string senderEmailId = "nick@gmail.com"; string sendSubject = "Feedback"; string sendMsg = "Your message"; EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE; map<string,string>otherMetaHeaders; otherMetaHeaders["template"] = "Your Template Name";//Which you are created from AppHQ. App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->setOtherMetaHeaders(otherMetaHeaders); emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,app42callback(Sample_Class::onEmailRequestCompleted, this)); void Sample_Class::onEmailRequestCompleted(void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { printf("\n From=%s",emailResponse->from.c_str()); printf("\n To=%s",emailResponse->to.c_str()); printf("\n Subject=%s",emailResponse->subject.c_str()); printf("\n Body=%s",emailResponse->body.c_str()); } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }String sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>(); otherMetaHeaders.Add("template", "Your Template Name");//Which you are created from AppHQ. App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.SetOtherMetaHeaders(otherMetaHeaders); Email email = emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime); Console.WriteLine("emailId is " + email.GetFrom()); Console.WriteLine("Host is " + email.GetSubject()); String jsonResponse = email.ToString();$sendTo = "john@shephertz.co.in"; $sendSubject = "Feedback"; $sendMsg = "Your message"; $senderEmailId = "nick@gmail.com"; $emailMime = EmailMIME::PLAIN_TEXT_MIME_TYPE; $otherMetaHeaders = array(); $otherMetaHeaders['template'] ="Your Template Name";//Which you are created from AppHQ. App42API::initialize("API_KEY","SECRET_KEY"); $emailService = App42API::buildEmailService(); $emailService->setOtherMetaHeaders($otherMetaHeaders); $email = $emailService->sendMail($senderEmailId, $sendTo, $sendSubject, $sendMsg, $emailMime); print_r("Email From is : " .$email->getFrom()); print_r("email To is : " .$email->getTo()); print_r("Subject is : " .$email->getSubject()); print_r("Message Body is : " .$email->getBody()); $jsonResponse = $email->toString();string sendTo = "john@shephertz.co.in"; string senderEmailId = "nick@gmail.com"; string sendSubject = "Feedback"; string sendMsg = "Your message"; EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE; map<string,string>otherMetaHeaders; otherMetaHeaders["template"] = "Your Template Name";//Which you are created from AppHQ. App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->setOtherMetaHeaders(otherMetaHeaders); emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted)); void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { printf("\n From=%s",emailResponse->from.c_str()); printf("\n To=%s",emailResponse->to.c_str()); printf("\n Subject=%s",emailResponse->subject.c_str()); printf("\n Body=%s",emailResponse->body.c_str()); } else { printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); } }Coming Soonvar sendTo:String = "john@shephertz.co.in"; var sendSubject:String = "Feedback"; var sendMsg:String = "Your message"; var senderEmailId:String = "nick@gmail.com"; var emailMime:String="EmailMIME.PLAIN_TEXT_MIME_TYPE"; var otherMetaHeaders:Dictionary = new Dictionary(); otherMetaHeaders["template"] = "Your Template Name"; App42API.initialize("API_KEY","SECRET_KEY"); var emailService:EmailService = App42API.buildEmailService(); emailService.setOtherMetaHeaders(otherMetaHeaders); emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId,emailMime ,new callback()); class callback implements App42CallBack { public function onSuccess(response:Object):void { var emailObject:Email = Email(response); trace("Email From is : " +emailObject.getFrom()); trace("email To is : " +emailObject.getTo()); trace("Subject is : " + emailObject.getSubject()); trace("Message Body is : " + emailObject.getBody()); } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Coming SoonString sendTo = "john@shephertz.co.in"; String sendSubject = "Feedback"; String sendMsg = "Your message"; String senderEmailId = "nick@gmail.com"; EmailMIME emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE"; HashMap<String, String> otherMetaHeaders = new HashMap<String, String>(); otherMetaHeaders.put("template", "Your Template Name");//Which you are created from AppHQ. App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.setOtherMetaHeaders(otherMetaHeaders); Email email = emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE); System.out.println("emailId is " + email.getFrom()); System.out.println("subject is " + email.getSubject()); String jsonResponse = email.toString();
The functions available under Email API can throw some exceptions in abnormal conditions. For example if a developer is removing the email configuration that does not exist, the function will throw the App42Exception (as shown below) with the message as “Not Found” and the appErrorCode as “2303” and the details as “Email with the id ‘nick@gmail.com’ does not exist”.
String emailId = "nick@gmail.com"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); emailService.removeEmailConfiguration( emailId, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); } });String emailId = "nick@gmail.com"; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.RemoveEmailConfiguration(emailId, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object response) { Email email = (Email) response; String jsonResponse = email.ToString(); } }String *emailId = @"nick@gmail.com"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; EmailService *emailService = [App42API buildEmailService]; [emailService removeEmailConfiguration:emailId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Email *email = (Email*)responseObj; } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String *jsonText = exception.reason; } }];let emailId = "nick@gmail.com" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let emailService = App42API.buildEmailService() as? EmailService emailService?.removeEmailConfiguration(emailId, completionBlock:{ (success, response, exception) ->Void in if (success) { let email = response as! Email } else { var appErrorCode = exception.appErrorCode var httpErrorCode = exception.httpErrorCode if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } var jsonText = exception.reason! } )}String emailId = "nick@gmail.com"; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); try { Email email = emailService.removeEmailConfiguration(emailId); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }`String emailId = "nick@gmail.com"; App42Log.SetDebug(true); //Print output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); emailService.RemoveEmailConfiguration(emailId,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Log.Console("Success : " + response.ToString()); } public void OnException(Exception e) { App42Exception exception = (App42Exception)e; int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } }var emailId = "nick@gmail.com", result; var appErrorCode ; App42.initialize("API_KEY","SECRET_KEY"); var emailService = new App42Email(); emailService.removeEmailConfiguration(emailId,{ success: function(object) { }, error: function(error) { var pushNotification = JSON.parse(object); appErrorCode = pushNotification.app42Fault.appErrorCode; if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } });local emailId = "nick@gmail.com"; local App42CallBack = {} App42API:initialize("API_KEY","SECRET_KEY") local emailService = App42API:buildEmailService() emailService:removeEmailConfiguration(emailId,App42CallBack) function App42CallBack:onSuccess(object) print("Response is "..object:getStrResponse()); end function App42CallBack:onException(exception) local appErrorCode = exception:getAppErrorCode() if appErrorCode == 2303 then -- Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) elseif appErrorCode == 1401 then -- handle here for Client is not authorized elseif appErrorCode == 1500 then -- handle here for Internal Server Error end endstring emailId = "nick@gmail.com"; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->removeEmailConfiguration(emailId.c_str(),app42callback(Sample_Class::onEmailRequestCompleted, this)); void Sample_Class::onEmailRequestCompleted(void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { //Handle success response here } else { // Handle exceptions printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); if(emailResponse->appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(emailResponse->appErrorCode == 1401) { // handle here for Client is not authorized } else if(emailResponse->appErrorCode == 1500) { // handle here for Internal Server Error } } }String emailId = "nick@gmail.com"; App42API.Initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.BuildEmailService(); try { Email email = emailService.RemoveEmailConfiguration(emailId); } catch(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); }$emailId = "nick@gmail.com"; App42API::initialize("API_KEY","SECRET_KEY"); $emailService = App42API::buildEmailService(); try { $email = emailService->removeEmailConfiguration(emailId); } catch(App42Exception $exception) { $appErrorCode =$exception->getAppErrorCode(); $httpErrorCode = $exception->getHttpErrorCode(); if($appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if($appErrorCode == 1401) { // handle here for Client is not authorized } else if($appErrorCode == 1500) { // handle here for Internal Server Error } $jsonText = $exception->getMessage(); }string emailId = "nick@gmail.com"; App42API::Initialize("APP_KEY", "SECRET_KEY"); EmailService *emailService = App42API::BuildEmailService(); emailService->removeEmailConfiguration(emailId.c_str(),this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted)); void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response) { App42EmailResponse *emailResponse = (App42EmailResponse*)response; printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess); printf("\nResponse Body=%s",emailResponse->getBody().c_str()); if(emailResponse->isSuccess) { //Handle success response here } else { // Handle exceptions printf("\nerrordetails:%s",emailResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",emailResponse->appErrorCode); printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode); if(emailResponse->appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(emailResponse->appErrorCode == 1401) { // handle here for Client is not authorized } else if(emailResponse->appErrorCode == 1500) { // handle here for Internal Server Error } } }Coming SoonComing SoonComing SoonString emailId = "nick@gmail.com"; App42API.initialize("API_KEY","SECRET_KEY"); EmailService emailService = App42API.buildEmailService(); try { Email email = emailService.removeEmailConfiguration(emailId); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2303) { // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }
Functions in Email API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
2300 - NOT FOUND - Email parameters not found.
2301 - BAD REQUEST - The request parameters are invalid. Email id '@emailId' already exists.
2302 - NOT FOUND - Email configurations do not exist.
2303 - NOT FOUND - Email with the id '@emailId' does not exist.